release #9
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Release version' | |
required: true | |
env: | |
JAVA_VERSION: '17' | |
JAVA_DISTRO: 'temurin' | |
jobs: | |
precheck: | |
name: Precheck | |
runs-on: ubuntu-latest | |
outputs: | |
VERSION: ${{ steps.vars.outputs.VERSION }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DISTRO }} | |
- name: Build | |
run: ./gradlew test jsonPlugin | |
- name: Version | |
id: vars | |
shell: bash | |
run: | | |
VERSION=${{ github.event.inputs.version }} | |
sed -i "s/^[#]*\s*version=.*/version=$VERSION/" gradle.properties | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "GitHub Action" | |
git commit -a -m "Releasing version $VERSION" | |
git push origin main | |
release: | |
needs: [ precheck ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
fetch-depth: 0 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DISTRO }} | |
- name: Build | |
run: ./gradlew jsonPlugin | |
- name: Prepare | |
run: ./gradlew jreleaserConfig | |
env: | |
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }} | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Assemble | |
run: ./gradlew jreleaserAssemble | |
env: | |
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }} | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release | |
run: ./gradlew jreleaserRelease | |
env: | |
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }} | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: JReleaser output | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: jreleaser-release | |
path: | | |
build/jreleaser/trace.log | |
build/jreleaser/output.properties |