Skip to content

Commit

Permalink
chore: Improve CI some more
Browse files Browse the repository at this point in the history
  • Loading branch information
phinner committed May 12, 2024
1 parent 6a4e357 commit 47079a5
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ on:
tags-ignore: [ "**" ]
pull_request:
release:
types: [ released ]
types: [ released, prereleased ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
cancel-in-progress: true

jobs:
Expand All @@ -21,17 +21,17 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/actions/wrapper-validation@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'gradle'
distribution: "temurin"
cache: "gradle"

- name: Build Artifact
run: ./gradlew build
Expand All @@ -41,21 +41,14 @@ jobs:
run: echo "ARTIFACT_PATH=$(./gradlew getArtifactPath -q)" >> $GITHUB_ENV

- name: Upload Artifact to Actions
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: ${{ env.ARTIFACT_PATH }}

- name: Determine Status
run: |
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
echo "STATUS=snapshot" >> $GITHUB_ENV
else
echo "STATUS=release" >> $GITHUB_ENV
fi
if-no-files-found: error

- name: Upload Artifact to Release
if: ${{ env.STATUS == 'release' && github.event_name == 'release' }}
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -64,15 +57,15 @@ jobs:
tag: ${{ github.ref }}

- name: Update Changelog
if: ${{ env.STATUS == 'release' && github.event_name == 'release' }}
if: ${{ github.event_name == 'release' }}
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.tag_name }}
release-notes: ${{ github.event.release.body }}

- name: Commit Updated Changelog
if: ${{ env.STATUS == 'release' && github.event_name == 'release' }}
uses: stefanzweifel/git-auto-commit-action@v4
if: ${{ github.event_name == 'release' }}
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: ${{ github.event.release.target_commitish }}
commit_message: Update CHANGELOG
Expand Down

0 comments on commit 47079a5

Please sign in to comment.