fix: issue 418 (#424) #80
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: Release and Publish | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| IMAGE_NAME: ghcr.io/rdflib/prez | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| packages: write # needed for ghcr.io push | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| new_release_version: ${{ steps.semantic.outputs.new_release_version }} | |
| new_release_published: ${{ steps.semantic.outputs.new_release_published }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Semantic Release | |
| id: semantic | |
| uses: cycjimmy/semantic-release-action@v4 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Debug Output | |
| run: | | |
| echo "New release published: ${{ steps.semantic.outputs.new_release_published }}" | |
| echo "New release version: ${{ steps.semantic.outputs.new_release_version }}" | |
| docker: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| if: needs.release.outputs.new_release_published == 'true' | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| - name: Update version | |
| run: poetry version ${{ needs.release.outputs.new_release_version }} | |
| - name: Docker metadata | |
| id: metadata | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=semver,pattern={{version}},value=${{ needs.release.outputs.new_release_version }} | |
| type=semver,pattern={{major}}.{{minor}},value=${{ needs.release.outputs.new_release_version }} | |
| type=semver,pattern={{major}},value=${{ needs.release.outputs.new_release_version }} | |
| type=raw,value=latest | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up and use Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container 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@v6 | |
| with: | |
| push: true | |
| build-args: PREZ_VERSION=${{ needs.release.outputs.new_release_version }} | |
| tags: ${{ steps.metadata.outputs.tags }} | |
| provenance: false | |
| platforms: linux/amd64,linux/arm64 |