-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (67 loc) · 2.42 KB
/
release.yml
File metadata and controls
76 lines (67 loc) · 2.42 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
name: NPM Latest Release
on:
workflow_dispatch:
inputs:
package:
description: 'Which package to release'
required: true
type: choice
options:
- sdk
- msf
- rwa
version_type:
description: 'Version type (minor, or major)'
required: true
default: 'minor'
type: choice
options:
- minor
- major
jobs:
publish-latest:
runs-on: ubuntu-latest
steps:
- name: Check user authorization
uses: actions/github-script@v7
with:
script: |
const authorizedUsers = '${{ secrets.AUTHORIZED_RELEASER }}'.split(',').map(u => u.trim());
const actor = '${{ github.actor }}';
if (!authorizedUsers.includes(actor)) {
core.setFailed(`User @${actor} is not authorized to perform this release.`);
}
console.log(`User @${actor} is authorized. Proceeding with release.`);
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Configure Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Install dependencies
run: npm install
- name: Build package
run: npm run build --workspace=@peaq-network/${{ github.event.inputs.package }}
- name: Bump Version
run: |
npm version ${{ github.event.inputs.version_type }} --workspace=@peaq-network/${{ github.event.inputs.package }} -m "chore(release): ${{ github.event.inputs.package }} %s"
- name: Pull and Push changes
run: |
git add packages/${{ github.event.inputs.package }}/package.json
git commit -m "ci: bump latest release"
git stash
git pull --rebase
git stash pop
git push https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }} HEAD:${{ github.ref }} --follow-tags
- name: Publish Package
run: npm publish --workspace=@peaq-network/${{ github.event.inputs.package }} --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}