Initial commit

This commit is contained in:
2023-12-19 22:24:29 +01:00
commit 2e58083957
14 changed files with 629 additions and 0 deletions

View File

@ -0,0 +1,29 @@
name: Build and Push Docker Image
on:
release:
types: [published]
jobs:
build docker:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository }}:latest,${{ env.REGISTRY }}/${{ github.repository }}:${{ github.ref_name }}

23
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: Python Lint
on: push
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Set up Python 3.11
run: |
apt update
apt install -y python3 python3-pip
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install -r requirements.txt
pip install pylint black isort
- name: Lint code
run: |
find . -type f -name "*.py" | xargs pylint
find . -type f -name "*.py" | xargs black --check
find . -type f -name "*.py" | xargs isort --check

View File

@ -0,0 +1,36 @@
name: Build Pypi Package
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --yes python3-setuptools python3-wheel
- name: Build
run: |
python3 -m build
- uses: actions/upload-artifact@v3
with:
path: ./dist
name: dist
pypi-publish:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/teleinfo_exporter/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
path: ./dist
name: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1