-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (75 loc) · 2.43 KB
/
Copy pathrelease.yaml
File metadata and controls
83 lines (75 loc) · 2.43 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
name: Release
on:
create:
tags:
- "v*"
permissions:
contents: write
jobs:
release:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
name: Release Kiwari Labs Contracts Library
runs-on: ubuntu-latest
steps:
- name: Determine Release Type
id: determine-release
run: |
TAG_NAME="${GITHUB_REF_NAME}"
if [[ "${TAG_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-rc\..* ]]; then
echo "RELEASE_TYPE=rc" >> $GITHUB_ENV
elif [[ "${TAG_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-beta\..* ]]; then
echo "RELEASE_TYPE=beta" >> $GITHUB_ENV
elif [[ "${TAG_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-alpha\..* ]]; then
echo "RELEASE_TYPE=alpha" >> $GITHUB_ENV
else
echo "RELEASE_TYPE=final" >> $GITHUB_ENV
fi
- name: Create release
env:
TAG_NAME: ${{ github.ref_name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ "${RELEASE_TYPE}" == "rc" || "${RELEASE_TYPE}" == "beta" || "${RELEASE_TYPE}" == "alpha" ]]; then
gh release create "$TAG_NAME" \
--repo="$GITHUB_REPOSITORY" \
--title="${TAG_NAME}" \
--prerelease \
--generate-notes
else
gh release create "$TAG_NAME" \
--repo="$GITHUB_REPOSITORY" \
--title="${TAG_NAME}" \
--generate-notes
fi
publish-npm:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
name: "Publish the new version to npmjs"
runs-on: ubuntu-22.04
needs: release
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
cache: "yarn"
node-version: 18.x
architecture: x64
registry-url: https://registry.npmjs.org/
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Testing Contracts
run: yarn test
- name: Build the Contracts
run: yarn build
- name: Publish
run: |
if [[ "${RELEASE_TYPE}" == "rc" || "${RELEASE_TYPE}" == "beta" || "${RELEASE_TYPE}" == "alpha" ]]; then
cd contracts
yarn publish --tag next --access public
else
cd contracts
yarn publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}