Build and Publish Image #121
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Publish Image | |
| on: | |
| workflow_run: | |
| workflows: ["Semantic Release"] | |
| types: | |
| - completed | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-tags: true | |
| - name: Set up qemu | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: registry auth | |
| uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: extract version | |
| run: | | |
| echo "VERSION=$(grep __version__ templatron/__init__.py | cut -f 2 -d = | tr -d ' ' | tr -d \")" >> "$GITHUB_ENV" | |
| - name: image metadata | |
| id: meta | |
| uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f | |
| with: | |
| flavor: | | |
| latest=true | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,enable=true,value=${{ env.VERSION }} | |
| - name: build & push image | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 | |
| with: | |
| build-args: UPSTREAM_VERSION=${{ env.UPSTREAM_VERSION }} | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |