name: Build Package/Image on: release: types: [published] jobs: build-image: runs-on: ubuntu-latest steps: - name: checkout code uses: actions/checkout@v4.1.1 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to Docker registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v5.1.0 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ github.ref_name }} build-package: runs-on: ubuntu-latest steps: - name: checkout code uses: actions/checkout@v4.1.1 - name: Set up Python uses: actions/setup-python@v5 - name: Install dependencies run: | python3 -m pip install --upgrade pip python3 -m pip install --upgrade build - name: Build run: python3 -m build - uses: actions/upload-artifact@v4.3.1 with: path: ./dist name: dist pypi-publish: runs-on: ubuntu-latest needs: build-package environment: name: pypi url: https://pypi.org/p/teleinfo_exporter/ permissions: id-token: write steps: - uses: actions/download-artifact@v4.1.2 with: path: ./dist name: dist - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_TOKEN }}