forked from real-logic/agrona
-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (119 loc) · 3.63 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Release
on:
workflow_dispatch:
inputs:
release:
description: Is release? (Will create tag and update version)
required: true
default: false
type: boolean
release-version:
description: Released version (x.y.z)
required: true
type: string
next-version:
description: Next version (x.y.z)
required: true
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
env:
GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.java.installations.auto-detect=false -Dorg.gradle.warning.mode=fail'
jobs:
# ci:
# uses: ./.github/workflows/ci.yml
#
# ci-low-cadence:
# uses: ./.github/workflows/ci-low-cadence.yml
#
# codeql:
# uses: ./.github/workflows/codeql.yml
pre-release:
name: Update version, tag repo, and return sha
permissions:
contents: write
# needs: [ ci, ci-low-cadence, codeql ]
runs-on: self-hosted
outputs:
sha: ${{ steps.return-sha.outputs.sha }}
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- id: validate
name: Validate no new commits
run: |
current_sha=$(git rev-parse HEAD)
if test $current_sha != '${{ github.sha }}'
then exit 1
fi
- id: tag-version
if: ${{ inputs.release }}
name: Update version, tag repo, and return current SHA
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
echo ${{ inputs.release-version }} > version.txt
git add version.txt
git commit -m "${{ inputs.release-version }} version update."
git push
git tag ${{ inputs.release-version }}
git push origin refs/tags/${{ inputs.release-version }}
- id: return-sha
name: Return current SHA
run: |
git rev-parse HEAD
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
release:
name: Release java artifacts
permissions:
contents: read
packages: write
needs: pre-release
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ needs.pre-release.outputs.sha }}
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 8
- name: Setup BUILD_JAVA_HOME & BUILD_JAVA_VERSION
run: |
java -Xinternalversion
echo "BUILD_JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV
echo "BUILD_JAVA_VERSION=8" >> $GITHUB_ENV
- name: Publish a release
run: ./gradlew publish
env:
SIGNING_GPG_SECRET_KEY: ${{ secrets.signingKey }}
SIGNING_GPG_PASSWORD: ${{ secrets.signingPassword }}
OSSRH_USERNAME: ${{ secrets.ossrhUsername }}
OSSRH_PASSWORD: ${{ secrets.ossrhPassword }}
post-release:
name: Update version
permissions:
contents: write
needs: release
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Commit snapshot version to current branch
if: ${{ inputs.release }}
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
echo ${{ inputs.next-version }}-SNAPSHOT > version.txt
git add version.txt
git status
git commit -m "${{ inputs.next-version }}-SNAPSHOT version update."
git push