-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (81 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Release
run-name: ${{ format('Release version {0}', inputs.version)}} by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (without v)'
required: true
type: string
snapshot:
description: 'Next SNAPSHOT version (without v). Defaults to current value'
required: false
type: string
pull_request:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
security-events: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: kcc-UID2-2558-enable-branch-protection
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Update Git user
run: |
git config --local user.name "IABTechLab"
git config --local user.email [email protected]
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- uses: gradle/gradle-build-action@v2
with:
# Disable writing to cache. Don't want to spoil the main cache
cache-read-only: true
- name: Get Snaptshot versions
id: snapshotVersions
run: ./scripts/get_snapshot_versions.sh ${{ inputs.snapshot }}
- name: Prepare for release metadata
shell: bash
run: |
sed -i.bak "s/${{ steps.snapshotVersions.outputs.cur_snapshot_version }}/${{ inputs.version }}/g" gradle.properties
- name: Commit gradle.properties and set tag for v${{ inputs.version }}
uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@v2
with:
add: 'gradle.properties'
message: 'Prepare for release: ${{ inputs.version }}'
tag: v${{ inputs.version }}
- name: Deploy v${{ inputs.version }}
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_REPO_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_REPO_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSPHRASE }}
- name: Prepare next Snapshot version ${{ steps.snapshotVersions.outputs.new_snapshot_version }}
shell: bash
run: |
echo "Setting next snapshot version ${{ steps.snapshotVersions.outputs.new_snapshot_version }}"
sed -i.bak "s/${{ inputs.version }}/${{ steps.snapshotVersions.outputs.new_snapshot_version }}/g" gradle.properties
- name: Commit gradle.properties for Snapshot version ${{ steps.snapshotVersions.outputs.new_snapshot_version }}
uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@v2
with:
add: 'gradle.properties'
message: 'Prepare next development version: ${{ steps.snapshotVersions.outputs.new_snapshot_version }}'
- name: Remove the backup file from sed edits
shell: bash
run: |
rm gradle.properties.bak
- name: GitHub Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
tag_name: v${{ inputs.version }}