-
-
Notifications
You must be signed in to change notification settings - Fork 2
90 lines (74 loc) · 2.27 KB
/
Copy pathrelease.yml
File metadata and controls
90 lines (74 loc) · 2.27 KB
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
name: Release
on:
workflow_dispatch:
inputs:
release_type:
description: 'Release type (patch, minor, major, or a semver version)'
required: false
type: string
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Install SwiftFormat
uses: ./.github/actions/install-swiftformat
- name: Lint files
run: yarn lint
- name: Format code
run: yarn format
- name: Verify formatted code is unchanged
run: git diff --exit-code HEAD
- name: Typecheck files
run: yarn typecheck
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Run tests
run: yarn test
build-release:
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
- name: Build package
run: yarn package build
- name: Set NPM token & GitHub config
run: |
npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
git config user.name "Kuatsu CI/CD"
git config user.email "null@kuatsu.de"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Validate release type
if: ${{ inputs.release_type != '' }}
run: |
if [[ "${{ inputs.release_type }}" =~ ^(patch|minor|major)$ ]]; then
echo "Valid release type: ${{ inputs.release_type }}"
elif [[ "${{ inputs.release_type }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Valid semver version: ${{ inputs.release_type }}"
else
echo "Invalid input. Must be 'patch', 'minor', 'major', or a valid semver version (e.g., 1.2.3)."
exit 1
fi
- name: Release
run: |
if [ -n "${{ inputs.release_type }}" ]; then
yarn package release --increment ${{ inputs.release_type }}
else
yarn package release
fi
env:
GITHUB_TOKEN: ${{ secrets.CICD_PAT }}