-
Notifications
You must be signed in to change notification settings - Fork 172
81 lines (78 loc) · 3.3 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
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"
env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx2g -Xms2g
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
# Given a tag, determine what branch we are on, so we can bump dependencies in the correct branch
- name: Get Branch
run: |
BRANCHES=$(git branch -r --contains ${{ github.ref }})
echo "BRANCHES is '${BRANCHES}'"
# Check for no branches explicitly...Otherwise echo adds a newline so wc thinks there's
# one branch. And echo -n makes it appears that there's one less branch than there
# actually is.
if [ -z "$BRANCHES" ]; then
echo "exactly one branch required to release kork, but there are none"
exit 1
fi
NUM_BRANCHES=$(($(echo "$BRANCHES" | wc -l)))
echo "NUM_BRANCHES is '${NUM_BRANCHES}'"
if [ $NUM_BRANCHES -ne 1 ]; then
echo "exactly one branch required to release kork, but there are $NUM_BRANCHES ($BRANCHES)"
exit 1
fi
echo "exactly one branch ($BRANCHES)"
echo BRANCH=$BRANCHES >> $GITHUB_ENV
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'zulu'
cache: 'gradle'
- name: Assemble release info
id: release_info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
. .github/workflows/release_info.sh ${{ github.event.repository.full_name }}
echo CHANGELOG=$(echo -e "${CHANGELOG}") >> $GITHUB_OUTPUT
echo SKIP_RELEASE="${SKIP_RELEASE}" >> $GITHUB_OUTPUT
echo IS_CANDIDATE="${IS_CANDIDATE}" >> $GITHUB_OUTPUT
echo RELEASE_VERSION="${RELEASE_VERSION}" >> $GITHUB_OUTPUT
- name: Release build
env:
ORG_GRADLE_PROJECT_version: ${{ steps.release_info.outputs.RELEASE_VERSION }}
ORG_GRADLE_PROJECT_nexusPublishEnabled: true
ORG_GRADLE_PROJECT_nexusUsername: ${{ secrets.NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_nexusPassword: ${{ secrets.NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_nexusPgpSigningKey: ${{ secrets.NEXUS_PGP_SIGNING_KEY }}
ORG_GRADLE_PROJECT_nexusPgpSigningPassword: ${{ secrets.NEXUS_PGP_SIGNING_PASSWORD }}
run: |
./gradlew --info publishToNexus closeAndReleaseNexusStagingRepository
- name: Create release
if: steps.release_info.outputs.SKIP_RELEASE == 'false'
uses: softprops/action-gh-release@v2
with:
body: |
${{ steps.release_info.outputs.CHANGELOG }}
draft: false
name: ${{ github.event.repository.name }} ${{ github.ref_name }}
prerelease: ${{ steps.release_info.outputs.IS_CANDIDATE }}
tag_name: ${{ github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Pause before dependency bump
run: sleep 600
- name: Trigger dependency bump workflow
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.SPINNAKER_GITHUB_TOKEN }}
event-type: bump-dependencies
client-payload: '{"ref": "${{ github.ref }}", "branch": "${{ env.BRANCH}}"}'