From 2cdfe0142a305625c8017daa61d6e60fa77db024 Mon Sep 17 00:00:00 2001 From: Arthur Deierlein Date: Wed, 17 Apr 2024 12:15:00 +0200 Subject: [PATCH] chore(ci): semantic release --- .github/workflows/release.yaml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 18992214..bea7700c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,21 +1,32 @@ --- -name: Release Container Image +name: Release on: push: branches: [main] - tags: - - "v*.*.*" jobs: - container: + semrel: + name: Semantic Release runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 + - name: Semantic Release + uses: go-semantic-release/action@v1 + id: semrel + with: + github-token: ${{ secrets.ADFINISBOT_PAT }} + + - name: Bump Version + if: steps.semrel.outputs.version != '' + run: | + pipx run poetry version "${{ steps.semrel.outputs.version }}" + - name: Docker meta id: meta + if: steps.semrel.outputs.version != '' uses: docker/metadata-action@v5 with: images: ghcr.io/adfinis/timed-backend @@ -30,6 +41,7 @@ jobs: org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }} - name: Login to GHCR + if: steps.semrel.outputs.version != '' uses: docker/login-action@v3 with: registry: ghcr.io @@ -37,12 +49,12 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push - id: docker_build_ghcr + if: steps.semrel.outputs.version != '' uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile - push: ${{ github.event_name != 'pull_request' }} + push: true tags: ${{ steps.meta.outputs.tags }} labels: | ${{ steps.meta.outputs.labels }}