-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (38 loc) · 1.48 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# A Workflow for triggering a new release.
#
# Releasing is a two stage process.
# 1. Running this workflow will check the build is green and then push a release tag to the repo, e.g. v1.2.3
# 2. Pushing the release tag (e.g. v1.2.3) will trigger the main CI build.yml.
# This main build has conditional steps that only run, or only don't run, when building a release build, i.e. a build triggered when a release tag is pushed.
name: Release
on: [workflow_dispatch]
permissions:
contents: read
concurrency: "${{ github.repository }}-versioning"
jobs:
release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: ${{ secrets.TRIGGER_GITHUB_TOKEN }}
- name: Fetch version history
run: git fetch --tags --unshallow
- name: Set up JDK
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Ensure build is green
run: ./gradlew build
- name: Release
run: |
# The following command will trigger the build.yml workflow as it pushes a release tag
./gradlew release -Prelease.pushTagsOnly
- name: Capture version info
run: |
echo "Release version: $(./gradlew cV -q -Prelease.quiet)" >> $GITHUB_STEP_SUMMARY