-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (90 loc) · 3.51 KB
/
release_workflow.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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 '[email protected]'
git config --local user.name ${{ github.actor }}
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: rive_code_generator_macosx
path: ./artifacts
- name: Rename downloaded file
run: mv ./artifacts/rive_code_generator ./artifacts/rive_code_generator_macosx
- name: Major Release
if: ${{ inputs.major == true }}
run: npm run release -- major --ci --github.assets=../../../artifacts/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=../../../artifacts/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=../../../artifacts/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=../../../artifacts/rive_code_generator_macosx
working-directory: ./.github/scripts/release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}