Create Release #6
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 Release | |
on: | |
workflow_dispatch: | |
inputs: | |
major: | |
description: "Major" | |
type: boolean | |
default: false | |
minor: | |
description: "Minor" | |
type: boolean | |
default: false | |
patch: | |
description: "Patch" | |
type: boolean | |
default: false | |
beta: | |
description: "Beta" | |
type: boolean | |
default: false | |
jobs: | |
build: | |
uses: ./.github/workflows/build_rive_code_generator.yaml | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Validate inputs | |
run: | | |
if [[ "${{ inputs.major }}" == "true" && "${{ inputs.minor }}" == "true" ]] || \ | |
[[ "${{ inputs.major }}" == "true" && "${{ inputs.patch }}" == "true" ]] || \ | |
[[ "${{ inputs.minor }}" == "true" && "${{ inputs.patch }}" == "true" ]]; then | |
echo "Error: Only one of major, minor, or patch can be set to true." | |
exit 1 | |
fi | |
if [[ "${{ inputs.major }}" != "true" && \ | |
"${{ inputs.minor }}" != "true" && \ | |
"${{ inputs.patch }}" != "true" && \ | |
"${{ inputs.beta }}" != "true" ]]; then | |
echo "Error: At least one of major, minor, patch, or beta must be set to true." | |
exit 1 | |
fi | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm ci | |
working-directory: ./.github/scripts/release | |
- name: Configure Git | |
run: | | |
git config --local user.email 'hello@rive.app' | |
git config --local user.name ${{ github.actor }} | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: rive_code_generator_macosx | |
- name: Major Release | |
if: ${{ inputs.major == true }} | |
run: npm run release -- major --ci --github.assets=rive_code_generator_macosx ${{ inputs.beta && '--preRelease=beta' || '' }} | |
working-directory: ./.github/scripts/release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Minor Release | |
if: ${{ inputs.major == false && inputs.minor == true }} | |
run: npm run release -- minor --ci --github.assets=rive_code_generator_macosx ${{ inputs.beta && '--preRelease=beta' || '' }} | |
working-directory: ./.github/scripts/release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Patch Release | |
if: ${{ inputs.major == false && inputs.minor == false && inputs.patch == true }} | |
run: npm run release -- --ci --github.assets=rive_code_generator_macosx ${{ inputs.beta && '--preRelease=beta' || '' }} | |
working-directory: ./.github/scripts/release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Beta Release | |
if: ${{ inputs.major == false && inputs.minor == false && inputs.patch == false && inputs.beta == true }} | |
run: npm run release -- --preRelease --ci --github.assets=rive_code_generator_macosx | |
working-directory: ./.github/scripts/release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |