-
Notifications
You must be signed in to change notification settings - Fork 3
60 lines (58 loc) · 1.84 KB
/
release.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
name: Release
on:
push:
branches: [master, feature/*]
jobs:
release:
name: Release
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with: { fetch-depth: 0 }
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Set Branch
id: branch
run: |
BNAME="$(echo -n ${GITHUB_REF##*/} | sed 's#/#-#g' | tr '[:upper:]' '[:lower:]')"
BID="$GITHUB_RUN_NUMBER-$(date +%s)"
echo "BRANCH_NAME=$BNAME" >> $GITHUB_ENV
echo "APP_BUILD=$BID-$GITHUB_SHA" >> $GITHUB_ENV
echo "BUILD_ID=$BID" >> $GITHUB_ENV
- name: Setup GIT
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
mkdir -p ~/.ssh
ssh-keyscan github.com > ~/.ssh/known_hosts
- name: Setup NPM
run: |
echo "Setup NPM"
echo 'always-auth=true' > ~/.npmrc
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> ~/.npmrc
echo '//npm.pkg.github.com/:_authToken=${GH_TOKEN}' >> ~/.npmrc
- name: Install dependencies
run: npm ci
- name: Check
run: |
npm run check-types
npm run lint
npm run test
- name: Build
run: npm run build
- name: Release GITHUB
run: |
if [[ $BRANCH_NAME == 'master' ]]; then
echo "Release production"
npm run release publish-github publish-npmjs
else
echo "Release canary"
npm run release -- publish-github prerelease=$BRANCH_NAME.$BUILD_ID
fi