Create a release #115
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: Create a release | |
on: | |
workflow_dispatch: | |
inputs: | |
semver: | |
description: "New version or major, minor, patch, project" | |
default: "patch" | |
required: true | |
type: string | |
retry: | |
description: "Retry release (clear created tag)" | |
default: false | |
required: true | |
type: boolean | |
dry_run: | |
description: "Test capabilities, do not release" | |
default: false | |
required: true | |
type: boolean | |
env: | |
JAVA_VERSION: 17 | |
JAVA_DISTRO: temurin | |
GRAALVM_DIST: graalvm-community | |
GH_BOT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com" | |
GH_BOT_NAME: "GitHub Action" | |
CI: true | |
permissions: read-all | |
jobs: | |
main-root: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' && github.repository == 'ebullient/ttrpg-convert-cli' | |
steps: | |
- name: Echo a message | |
id: is-main-root | |
run: echo "This is the main branch of 'ebullient/ttrpg-convert-cli'" | |
build_tag: | |
runs-on: ubuntu-latest | |
needs: main-root | |
outputs: | |
artifact: ${{ steps.git-commit-tag.outputs.artifact }} | |
snapshot: ${{ steps.git-commit-tag.outputs.snapshot }} | |
version: ${{ steps.git-commit-tag.outputs.next }} | |
current: ${{ steps.git-commit-tag.outputs.current }} | |
permissions: | |
contents: write | |
actions: write | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
# Fetches all tags for the repo | |
- name: Fetch tags | |
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- name: Set up JDK ${{ env.JAVA_VERSION }} | |
uses: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DISTRO }} | |
cache: maven | |
- name: Commit and Tag release | |
id: git-commit-tag | |
env: | |
INPUT: ${{ inputs.semver }} | |
RETRY: ${{ inputs.retry }} | |
DRY_RUN: ${{ inputs.dry_run }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COMMIT_PATHS: "README-WINDOWS.md docs examples" | |
TEXT_REPLACE: "README.md README-WINDOWS.md docs/alternateRun.md" | |
run: | | |
gh repo clone ebullient/workflows shared-workflows -- --depth=1 | |
git config user.name ${{ env.GH_BOT_NAME }} | |
git config user.email ${{ env.GH_BOT_EMAIL }} | |
## Check and update version, build, and create tag | |
## outputs: CURRENT SNAPSHOT ARTIFACT NEXT | |
. ./shared-workflows/version-build-tag.sh | |
cp -R src/main/resources/templates default | |
zip -r target/${ARTIFACT}-${NEXT}-examples.zip docs examples default | |
- name: Upload ${{ steps.git-commit-tag.outputs.artifact }}-${{ steps.git-commit-tag.outputs.next }}-runner.jar | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
id: upload-jar | |
with: | |
name: artifacts-runner | |
path: target/${{ steps.git-commit-tag.outputs.artifact }}-${{ steps.git-commit-tag.outputs.next }}-runner.jar | |
- name: Upload ${{ steps.git-commit-tag.outputs.artifact }}-${{ steps.git-commit-tag.outputs.next }}-examples.zip | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
id: upload-zip | |
with: | |
name: artifacts-examples | |
path: target/${{ steps.git-commit-tag.outputs.artifact }}-${{ steps.git-commit-tag.outputs.next }}-examples.zip | |
native-binaries: | |
needs: build_tag | |
uses: ebullient/workflows/.github/workflows/java-release-native-binaries.yml@main | |
permissions: | |
contents: read | |
actions: write | |
with: | |
version: ${{ needs.build_tag.outputs.version }} | |
secrets: inherit | |
release: | |
needs: [build_tag, native-binaries] | |
uses: ebullient/workflows/.github/workflows/jreleaser-release.yml@main | |
permissions: | |
contents: write | |
actions: write | |
with: | |
dry_run: ${{ inputs.dry_run }} | |
extras: "${{ needs.build_tag.outputs.artifact }}-${{ needs.build_tag.outputs.version }}-examples.zip" | |
version: ${{ needs.build_tag.outputs.version }} | |
secrets: inherit | |
release-prep-next: | |
needs: [build_tag, release] | |
uses: ebullient/workflows/.github/workflows/java-release-prep-next.yml@main | |
permissions: | |
contents: write | |
with: | |
dry_run: ${{ inputs.dry_run }} | |
snapshot: ${{ needs.build_tag.outputs.snapshot }} | |
secrets: inherit |