-
Notifications
You must be signed in to change notification settings - Fork 16
93 lines (76 loc) · 2.36 KB
/
release-packages.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# This is a basic workflow to help you get started with Actions
name: release-packages
env:
LAB_NPM_TOKEN: ${{ secrets.LAB_NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PERSONAL_TOKEN: ${{ secrets.GH_TOKEN }}
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: ['release', 'beta', 'alpha']
workflow_dispatch:
inputs:
branch:
description: 'Frontend branch'
required: false
default: 'release'
type: choice
options:
- release
- alpha
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 14
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Show env
run: |
echo $RELEASE_VERSION
- name: Install dependencies
run: pnpm install
- name: Build packages
run: pnpm run build
- name: Set npm registry
run: |
npm config set registry https://registry.npmjs.com/
npm config set //registry.npmjs.com/:_authToken ${NPM_TOKEN}
- name: Publish packages
run: pnpm run release
env:
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
- name: Trigger release frontend workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: release-frontend
inputs: |
{
"branch": "${{ github.event.inputs.branch }}"
}