Release a new version #28
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 new version | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The version number to use (ex: 1.22.3)' | |
required: true | |
type: string | |
env: | |
RELEASE_VERSION: ${{ inputs.version }} | |
jobs: | |
create-release-pr: | |
name: Create a pull request for the release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install chan CLI | |
run: npm install -g @geut/chan | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
# This token allows committing modifications on workflow files (read/write on Contents, Pull Requests, and Workflows permissions) | |
token: ${{ secrets.RELEASE_TOKEN }} | |
- name: Write a new release to CHANGELOG.md | |
run: chan release $RELEASE_VERSION --release-prefix="" | |
- name: Update Akkurate's version in build files | |
run: | | |
echo 'version = "'$RELEASE_VERSION'"' > ./buildSrc/src/main/kotlin/akkurate.version.gradle.kts; | |
sed -ri 's|CONFIG_JSON_VERSION *:.*|CONFIG_JSON_VERSION: '$RELEASE_VERSION'|g' ./.github/workflows/deploy-website.yml; | |
sed -ri 's|<var.* name="version".*|<var name="version" value="'$RELEASE_VERSION'"/>|g' ./documentation/v.list; | |
sed -ri 's|<instance.* src="akkurate.tree".*|<instance src="akkurate.tree" version="'$RELEASE_VERSION'"/>|g' ./documentation/writerside.cfg; | |
- name: Commit and push | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: release ${{ inputs.version }} | |
branch: release/${{ inputs.version }} | |
create_branch: true | |
commit_author: Johann Pardanaud <[email protected]> | |
tagging_message: ${{ inputs.version }} | |
- name: Create a draft release | |
env: | |
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
# The tail command is used to remove an unnecessary title from the changelog. | |
run: chan show $RELEASE_VERSION | tail -n +2 | gh release create $RELEASE_VERSION --title "Akkurate $RELEASE_VERSION" --draft --notes-file - | |
- name: Create a pull request | |
env: | |
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
run: | | |
gh pr create --assignee nesk --base main --head release/$RELEASE_VERSION --title "Release $RELEASE_VERSION" --body "This a pull request for releasing version $RELEASE_VERSION of Akkurate. | |
### Before merging this pull-request | |
#### Maven Central Repository | |
Head to the [Nexus Repository Manager](https://s01.oss.sonatype.org/#stagingRepositories) and verify if the newly created staging repository is valid, meaning: | |
- all the artifacts are present (root directories starting with `akkurate-` in the sources); | |
- each artifact is built for nearly [all multiplatform targets](https://kotlinlang.org/docs/multiplatform-dsl-reference.html#targets); | |
- and all the files are signed with multiple `.asc` variations. | |
If everything is compliant to this checklist, close the repository, then release it. | |
#### GitHub release | |
Open the draft release created on GitHub. You can edit the description of the release to add any additional content you want, _but leave the changelog as-is._ Once you're satisfied, publish the release. | |
#### Finalize everything | |
Once everything above is done, you can merge this pull request. | |
### Aborting the release | |
In case you want to cancel everything and restart from a clean slate: | |
- Delete the tag and the branch: `git push --delete origin $RELEASE_VERSION release/$RELEASE_VERSION` | |
- Delete the release: `gh release delete $RELEASE_VERSION`" | |
publish: | |
name: Publish to Maven Central Repository | |
runs-on: macos-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: 8 | |
- name: Validate Gradle wrapper | |
uses: gradle/actions/wrapper-validation@v3 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Publish to Maven Central Repository | |
env: | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }} | |
SONATYPE_URL: ${{ vars.SONATYPE_URL }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
run: ./gradlew publish |