Skip to content

Commit 5eec503

Browse files
committed
workflow: simplify build+release flows
1 parent 6e47128 commit 5eec503

3 files changed

Lines changed: 96 additions & 35 deletions

File tree

.github/changelog.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
%YAML 1.1
2+
---
3+
resolve: commits
4+
owner: jimschubert
5+
repo: rewrite-docker
6+
groupings:
7+
- name: Recipes
8+
patterns: ['(?i)^recipe\b', '(?i)^rewrite\b', '(?i)^refactor\b', '(?i)^add\b', '(?i)^create\b']
9+
- name: Functionality
10+
patterns: ['(?i)^new\b', '(?i)^initial\b', '(?i)^support\b', '(?i)^introduce\b', '(?i)^feat\b']
11+
- name: Fixes
12+
patterns: ['(?i)^fix\b', '(?i)^bug', '(?i).*fixes$']
13+
- name: Uncategorized
14+
patterns: ['.*']
15+
exclude:
16+
- '^(?i)wip\b'
17+
- '^(?i)help\b'
18+
- '^(?i)doc\b'
19+
- '^(?i)docs\b'
20+
- '^(?i)test\b'
21+
- '^(?i)trying\b'
22+
- '^(?i)workflow\b'
23+
- '^(?i)update readme\b'
24+
- '^(?i)style\b'
25+
- '^(?i)chore\b'
26+
sort: asc
27+
max_commits: 250
28+
local: false

.github/workflows/build.yml

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ env:
77
GRADLE_VERSION: 8.8
88

99
jobs:
10-
publish:
10+
build:
11+
env:
12+
flags: ""
1113
name: Build and Check
1214
runs-on: ubuntu-latest
1315

@@ -37,14 +39,74 @@ jobs:
3739
gradle-home-cache-cleanup: true
3840
dependency-graph: generate-and-submit
3941

40-
- name: Build with Gradle
41-
run: ./gradlew build --stacktrace
42+
# tagged release
43+
- if: ${{ startsWith(github.ref, 'refs/tags/v') }}
44+
run: echo "flags=-Pversion=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
4245

43-
- name: Run tests
44-
run: ./gradlew test --stacktrace
46+
- name: Build with Gradle
47+
run: ./gradlew build test --stacktrace --no-daemon ${{ env.flags }}
4548

4649
- name: capture build artifacts
4750
uses: actions/upload-artifact@v4
4851
with:
4952
name: Artifacts
50-
path: 'versions/**/build/libs/*.jar'
53+
path: '**/build/libs/*.jar'
54+
55+
release:
56+
name: Release
57+
needs: build
58+
if: ${{startsWith(github.ref, 'refs/tags/v')}}
59+
runs-on: ubuntu-latest
60+
61+
permissions:
62+
contents: write
63+
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v3
67+
with:
68+
fetch-depth: 0
69+
70+
- name: Download artifacts
71+
uses: actions/download-artifact@v4
72+
with:
73+
name: Artifacts
74+
path: artifacts
75+
76+
- name: Find Last Tag
77+
id: last
78+
uses: jimschubert/query-tag-action@v1
79+
with:
80+
include: 'v*'
81+
exclude: '*-rc*'
82+
commit-ish: 'HEAD~'
83+
skip-unshallow: 'true'
84+
85+
- name: Find Current Tag
86+
id: current
87+
uses: jimschubert/query-tag-action@v1
88+
with:
89+
include: 'v*'
90+
exclude: '*-rc*'
91+
commit-ish: '@'
92+
skip-unshallow: 'true'
93+
94+
- name: Create Changelog
95+
id: changelog
96+
uses: jimschubert/beast-changelog-action@v1
97+
with:
98+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
99+
CONFIG_LOCATION: .github/changelog.yml
100+
FROM: ${{steps.last.outputs.tag}}
101+
TO: ${{steps.current.outputs.tag}}
102+
OUTPUT: .github/CHANGELOG.md
103+
104+
- name: View Changelog
105+
run: cat .github/CHANGELOG.md
106+
107+
- name: Create Release
108+
uses: softprops/action-gh-release@v1
109+
with:
110+
files: artifacts/**/*.jar
111+
body_path: .github/CHANGELOG.md
112+
generate_release_notes: false

.github/workflows/release.yml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,6 @@ jobs:
2222
- name: Checkout
2323
uses: actions/checkout@v3
2424

25-
- name: Set up Java ${{ env.JAVA_VERSION }}
26-
uses: actions/setup-java@v4
27-
with:
28-
distribution: 'corretto'
29-
java-version: ${{ env.JAVA_VERSION }}
30-
31-
- uses: actions/cache@v4
32-
with:
33-
path: |
34-
~/.gradle/caches
35-
~/.gradle/wrapper
36-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
37-
restore-keys: |
38-
${{ runner.os }}-gradle-
39-
40-
- name: Setup Gradle
41-
uses: gradle/actions/setup-gradle@v4
42-
with:
43-
gradle-version: ${{ env.GRADLE_VERSION }}
44-
45-
- name: Build with Gradle
46-
run: ./gradlew build -Pversion=${{ github.event.release.tag_name }}
47-
48-
- name: Upload Assets to Release
49-
uses: AButler/upload-release-assets@v3.0
50-
with:
51-
files: ./build/libs/*.jar
52-
repo-token: ${{ secrets.GITHUB_TOKEN }}
53-
5425
- name: Get the release version, removing the v from the tag
5526
id: get_version
5627
run: echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)