From cb534bcf1b8cb54fed181d0968756f10fe12996e Mon Sep 17 00:00:00 2001 From: Paul Wagner Date: Fri, 15 Nov 2024 20:56:34 +0100 Subject: [PATCH] Add release-tag workflow --- .github/workflows/build.yml | 15 ++++++++++++--- .github/workflows/release_tag.yml | 32 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release_tag.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 448951a..28a5bbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,7 @@ name: Build on: + workflow_call: push: branches: - main @@ -14,13 +15,21 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Java - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '18' + cache: gradle + - name: Build with Gradle - run: ./gradlew jar \ No newline at end of file + run: ./gradlew jar + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: model-checking + path: build/libs/model-checking-1.0-SNAPSHOT.jar \ No newline at end of file diff --git a/.github/workflows/release_tag.yml b/.github/workflows/release_tag.yml new file mode 100644 index 0000000..a9a2a37 --- /dev/null +++ b/.github/workflows/release_tag.yml @@ -0,0 +1,32 @@ +name: Release Tag + +on: + push: + tags: + - v* + +permissions: + contents: write + +jobs: + build: + uses: ./.github/workflows/build.yml + release-tag: + name: Release Tag + needs: build + runs-on: ubuntu-22.04 + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: model-checking + - name: Rename artifact + run: mv model-checking-*.jar model-checking-v${tag#v}.jar + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref_name }} + run: | + gh release create "$tag" model-checking-v${tag#v}.jar \ + --repo="$GITHUB_REPOSITORY" \ + --title="v${tag#v}" \ No newline at end of file