-
Notifications
You must be signed in to change notification settings - Fork 3
74 lines (73 loc) · 2.19 KB
/
main.yml
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
name: Main
on:
push:
branches:
- main
jobs:
commit-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Commit Lint
uses: wagoid/commitlint-github-action@v5
code-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: '18'
- uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-18-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Format
run: yarn run format
- name: Lint
run: yarn run lint
release:
if: "!contains(github.event.commits[0].message, '[skip ci]')"
needs: [commit-lint, code-lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: '18'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Disable protection temporary
uses: actions/[email protected]
with:
github-token: '${{ secrets.GASTROBOT_TOKEN}}'
script: |
await github.rest.repos.deleteAdminBranchProtection({
repo: '${{ github.event.repository.name }}',
owner: '${{ github.repository_owner }}',
branch: 'main',
});
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GASTROBOT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Restore protection
uses: actions/[email protected]
if: always()
with:
github-token: '${{ secrets.GASTROBOT_TOKEN}}'
script: |
await github.rest.repos.setAdminBranchProtection({
repo: '${{ github.event.repository.name }}',
owner: '${{ github.repository_owner }}',
branch: 'main',
});