-
Notifications
You must be signed in to change notification settings - Fork 7
100 lines (86 loc) · 4.41 KB
/
release-workflow.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
name: Release - Release RC and Update Documentation
env:
SONATYPE_USERNAME: embrace-io
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_QA_USER: github
MAVEN_QA_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
mavenSigningKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }}
mavenSigningKeyRingFileEncoded: ${{ secrets.MAVEN_ANDROID_GPG_KEY }}
mavenSigningKeyPassword: ${{ secrets.MAVEN_ANDROID_SIGNING_PASSWORD }}
on:
workflow_dispatch:
inputs:
version_to_release:
description: 'SDK version this workflow run will release. Specify <major.minor> only, without the patch number, e.g. 6.3. It will use the branch "release/<version>".'
required: true
patch_version_of_release:
description: 'The patch version for this release, i.e. the third number per semantic versioning <major.minor.patch>. If it is not a hotfix, use the default of 0'
required: true
default: '0'
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
jdk-version: [ "17" ]
ndk-version: [ "21.4.7075529" ]
steps:
- name: Checkout SDK
uses: actions/checkout@v4
with:
ref: release/${{ github.event.inputs.version_to_release }}
fetch-depth: 0
token: ${{ secrets.CD_GITHUB_TOKEN }}
- name: Set up JDK ${{ matrix.jdk-version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.jdk-version }}
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Gradlew Release SDK to Maven Central
run: |
./gradlew findSonatypeStagingRepository releaseSonatypeStagingRepository -Dorg.gradle.parallel=false --stacktrace
- name: Generate Documentation
run: ./gradlew dokkaHtml
- name: Configure git
run: |
git config --global user.name 'embrace-ci[bot]'
git config --global user.email '[email protected]'
git config --global url."https://${{ secrets.CD_GITHUB_USER }}:${{ secrets.CD_GITHUB_TOKEN }}@github.com".insteadOf "https://github.com"
- name: Publish gh-pages
run: |
mv docs .docs-newly-generated # new docs generated by previous step
git checkout gh-pages
git rm -rf docs # old docs on gh-pages branch
mv .docs-newly-generated docs
date > docs/version.txt
echo ${{ github.sha }} >> docs/version.txt
echo ${{ github.event.inputs.version_to_release }}.${{ github.event.inputs.patch_version_of_release }} >> docs/version.txt
git add -f docs
git config --global user.name "embrace-ci"
git config --global user.email "[email protected]"
git commit --allow-empty --message 'CI/CD: Automatically generated documentation for ${{ github.event.inputs.version_to_release }}.${{ github.event.inputs.patch_version_of_release }}' docs/
git push --force origin gh-pages
- name: Record SDK Version History (${{ github.event.inputs.version_to_release }}.${{ github.event.inputs.patch_version_of_release }})
run: |
curl -X POST ${{ vars.SDK_VERSION_URL }}/android/version/ -H 'X-Embrace-CI: ${{ secrets.SDK_VERSION_TOKEN }}' -H 'Content-Type: application/json' -d '{"version": "${{ github.event.inputs.version_to_release }}.${{ github.event.inputs.patch_version_of_release }}"}'
- name: Checkout Swazzler
uses: actions/checkout@v4
with:
repository: embrace-io/embrace-swazzler3
ref: release/${{ github.event.inputs.version_to_release }}
token: ${{ secrets.CD_GITHUB_TOKEN }}
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Gradlew Release Swazzler to Maven Central
run: |
./gradlew findSonatypeStagingRepository releaseSonatypeStagingRepository -Dorg.gradle.parallel=false --stacktrace
- name: Cleanup Gradle Cache
# Based on https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle#caching-dependencies
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties