Skip to content

Commit

Permalink
patch: Separate the workflows to generate release from tags
Browse files Browse the repository at this point in the history
  • Loading branch information
renatoaraujo committed Oct 9, 2023
1 parent 5722321 commit 4de544b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 31 deletions.
44 changes: 13 additions & 31 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,35 @@ name: Release

on:
push:
branches:
- main
tags:
- "*"

permissions:
contents: write

jobs:
test:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'oracle'
java-version: '21'

- name: Run Tests
run: ./gradlew test --no-daemon

release:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: '0'

- name: Bump version and push tag
id: version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
MAJOR_STRING_TOKEN: "major:"
MINOR_STRING_TOKEN: "minor:"
PATCH_STRING_TOKEN: "patch:"

- name: Set project version for Gradle
run: echo "version='${{ steps.version.outputs.new_tag }}'" >> gradle.properties
- run: echo "version='${{ env.GITHUB_REF_NAME }}'" >> gradle.properties

- name: Build fat JAR
- name: Build Jar
run: ./gradlew shadowJar --no-daemon

- uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.RELEASE_TOKEN }}"
automatic_release_tag: ${{ steps.version.outputs.new_tag }}
automatic_release_tag: ${{ env.GITHUB_REF_NAME }}
prerelease: false
files: |
build/libs/uk-invitation-letter-${{ steps.version.outputs.new_tag }}.jar
build/libs/uk-invitation-letter-${{ env.GITHUB_REF_NAME }}.jar
41 changes: 41 additions & 0 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Tag

on:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'oracle'
java-version: '21'

- name: Run Tests
run: ./gradlew test --no-daemon

tag:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: '0'

- name: Bump version and push tag
id: version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
MAJOR_STRING_TOKEN: "major:"
MINOR_STRING_TOKEN: "minor:"
PATCH_STRING_TOKEN: "patch:"
WITH_V: true

0 comments on commit 4de544b

Please sign in to comment.