From acd55abc50eb6752339318e55ee45529974ea497 Mon Sep 17 00:00:00 2001 From: Ben Bachem <10088265+bezbac@users.noreply.github.com> Date: Sun, 17 Mar 2024 14:37:18 +0100 Subject: [PATCH] Setup release workflow --- .github/workflows/build.yaml | 7 +++++ .github/workflows/check.yaml | 3 --- .github/workflows/release.yaml | 47 ++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 634c85e..804a6dc 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -5,6 +5,10 @@ on: push: branches: - main + tags: + - "v[0-9]+.[0-9]+.[0-9]+*" + # Push events to any matching semantic version tag. + # For example, 1.10.1 or 2.0.0 or 3.0.0-alpha. env: REGISTRY: ghcr.io @@ -55,6 +59,9 @@ jobs: tags: | type=sha type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=latest,enable={{is_default_branch}} - name: Build and push Docker image uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 07c6822..406cb5c 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -3,9 +3,6 @@ name: "Check" on: workflow_dispatch: push: - paths: - - flake.nix - - .github/workflows/check.yaml jobs: check-nix: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..174be90 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,47 @@ +name: Release + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+*" + # Push events to any matching semantic version tag. + # For example, 1.10.1 or 2.0.0 or 3.0.0-alpha. + +jobs: + release: + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Wait for tests to succeed + uses: lewagon/wait-on-check-action@v1.3.1 + with: + ref: ${{ github.ref }} + check-name: "build-and-push" + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 20 + + - name: Build changelog + id: changelog + uses: mikepenz/release-changelog-builder-action@v4 + with: + configuration: "release-changelog-builder-config.json" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create release + id: create_release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.ref }} + name: Release ${{ github.ref }} + body: ${{steps.changelog.outputs.changelog}} + draft: false + prerelease: false