Release version by @cYKatherine #29
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |