Repository navigation
115 lines (101 loc) · 4.33 KB
/
Copy pathrelease.yml
File metadata and controls
115 lines (101 loc) · 4.33 KB
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
name: Release
on:
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run: print the next version and the notes, change and publish nothing'
required: true
type: boolean
default: true
permissions:
contents: write
concurrency:
group: release
jobs:
release:
outputs:
version: ${{ steps.result.outputs.version }}
docs_version: ${{ steps.result.outputs.docs_version }}
# Appium TC members (GOVERNANCE.md in appium/appium) and the java-client reviewers (CODEOWNERS);
# keep in sync with them
if: >-
github.ref == 'refs/heads/master' &&
contains(fromJSON('["jlipps", "mykola-mokhnach", "eglitise", "KazuCocoa", "SrinivasanTarget", "saikrishna321", "valfirst"]'), github.actor)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Java
uses: actions/setup-java@v6
with:
java-version: '17'
distribution: 'zulu'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6.4.1
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Calculates the version from the conventional commits, updates gradle.properties and CHANGELOG.md,
# then commits and tags (unless dry run)
- name: Prepare the release
env:
DRY_RUN: ${{ inputs.dry_run }}
run: |
args=()
if [ "$DRY_RUN" = "true" ]; then args+=(--preview); fi
./gradlew release "${args[@]}"
- name: Read the result
id: result
run: |
if [ -f build/release/version.txt ]; then
# Outside the workspace: `gradlew clean` deletes build/
cp build/release/notes.md "$RUNNER_TEMP/release-notes.md"
echo "notes=$RUNNER_TEMP/release-notes.md" >> "$GITHUB_OUTPUT"
echo "version=$(cat build/release/version.txt)" >> "$GITHUB_OUTPUT"
# <major>.<minor>: patch releases update the same docs version
echo "docs_version=$(cut -d. -f1,2 build/release/version.txt)" >> "$GITHUB_OUTPUT"
{ echo "## Release v$(cat build/release/version.txt)"; cat build/release/notes.md; } >> "$GITHUB_STEP_SUMMARY"
else
echo "Nothing to release" >> "$GITHUB_STEP_SUMMARY"
fi
- name: Build and test the release commit
if: steps.result.outputs.version != '' && !inputs.dry_run
run: ./gradlew clean build
# Atomic: if master moved since the checkout, neither the commit nor the tag is pushed
- name: Push the release commit and the tag
if: steps.result.outputs.version != '' && !inputs.dry_run
run: git push --atomic origin "HEAD:master" "refs/tags/v${{ steps.result.outputs.version }}"
- name: Publish package
if: steps.result.outputs.version != '' && !inputs.dry_run
env:
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.SIGNING_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_SIGNING_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_SIGNING_PASSWORD }}
JRELEASER_MAVENCENTRAL_SONATYPE_USERNAME: ${{ secrets.OSSRH_USERNAME }}
JRELEASER_MAVENCENTRAL_SONATYPE_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
run: |
./gradlew publish
./gradlew jreleaserDeploy
# Created with GITHUB_TOKEN, so it does not trigger publish.yml a second time
- name: Create the GitHub release
if: steps.result.outputs.version != '' && !inputs.dry_run
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ steps.result.outputs.version }}" \
--title "v${{ steps.result.outputs.version }}" \
--notes-file "${{ steps.result.outputs.notes }}" --verify-tag
# Only after the tag is pushed and the artifacts are published (the job is skipped if `release` fails);
# a failed run can be repeated with "Re-run failed jobs"
docs:
needs: release
if: needs.release.outputs.version != '' && !inputs.dry_run
uses: ./.github/workflows/docs.yml
permissions:
contents: write
with:
version: ${{ needs.release.outputs.docs_version }}
alias: latest
ref: refs/tags/v${{ needs.release.outputs.version }}