Skip to content

Commit

Permalink
New release workflow with automatic latest/snapshot releasing (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
tajobe authored Mar 29, 2022
1 parent 8fea6bc commit acdda9d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 20 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build
on:
workflow_call:
outputs:
version:
description: Built version
value: ${{ jobs.build.outputs.version }}

jobs:
build:
name: Gradle Build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
java-version: 17
distribution: temurin
- uses: gradle/gradle-build-action@v2
- name: Gradle Build
run: ./gradlew build
- name: Get Version
id: version
run: echo ::set-output name=version::"$(./gradlew --console plain --quiet currentVersion -Prelease.quiet)"
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: build
path: build/libs/*.jar
retention-days: 7
12 changes: 1 addition & 11 deletions .github/workflows/pr-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,4 @@ on: pull_request

jobs:
build:
name: Gradle Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
java-version: 17
distribution: temurin
- uses: gradle/gradle-build-action@v2
with:
arguments: build
uses: ./.github/workflows/build-workflow.yml
22 changes: 13 additions & 9 deletions .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
name: Release
on:
push:
branches: ['master', 'main'] # TODO: master/main
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
build:
uses: ./.github/workflows/build-workflow.yml
release:
needs: build
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
- name: Download build
uses: actions/download-artifact@v3
with:
java-version: 17
distribution: temurin
- name: Gradle Build
uses: gradle/gradle-build-action@v2
with:
arguments: build
name: build
path: build
- name: Release
uses: docker://antonyurchenko/git-release:v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRAFT_RELEASE: "true"
RELEASE_NAME: ${{ needs.build.outputs.version }}
PRE_RELEASE: ${{ github.ref_type == 'branch' }}
UNRELEASED: ${{ github.ref_type == 'branch' && 'update' || '' }}
UNRELEASED_TAG: latest-snapshot
with:
args: |
build/libs/*.jar
build/*.jar

0 comments on commit acdda9d

Please sign in to comment.