Skip to content

Release (semver)

Release (semver) #12

Workflow file for this run

name: Release (semver)
on:
workflow_dispatch:
inputs:
semver:
type: choice
description: What kind of release is this?
required: true
default: patch
options:
- major
- minor
- patch
message:
type: string
description: An optional release message
required: false
jobs:
quality-assurance:
permissions:
actions: read
contents: read
security-events: write
packages: read
name: Quality Assurance
uses: ./.github/workflows/qa.yml
versioning:
name: Versioning
runs-on: ubuntu-latest
permissions:
contents: read
if: github.ref == 'refs/heads/main'
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: oss-actions/auto-semver@v0
id: version
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
type: ${{ inputs.semver }}
vprefix: disabled
release:
name: Release
runs-on: ubuntu-latest
needs: [ quality-assurance, versioning ]
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v3
# region todo(James Bradlee): Find an effective way to do this in a different job and
# download the cache and artifacts for immediate release when
# quality assurance is complete.
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Build
env:
VERSION: ${{ needs.versioning.outputs.version }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
run: ./gradlew build
- name: Release (packages)
env:
VERSION: ${{ needs.versioning.outputs.version }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
run: ./gradlew publish
# endregion
- name: Release (git tag)
env:
GITHUB_TOKEN: ${{ github.token }}
VERSION: ${{ needs.versioning.outputs.version }}
TITLE: ${{ inputs.message }}
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git tag $VERSION
git push -u origin $VERSION
# todo, upload release artifacts
# gh release create --verify-tag -t $TITLE