-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (47 loc) · 1.4 KB
/
generator-publish-artifact.yaml
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
name: Generate SDK - Publish
on:
workflow_call:
inputs:
production_release:
description: 'Release to Production'
type: boolean
required: true
jobs:
publish:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.publish.outputs.version }}
steps:
- uses: actions/download-artifact@v4
with:
name: sdk
path: generator/sdk
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Release
working-directory: generator/sdk
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [[ ${{github.event.inputs.production_release}} == 'true' ]]; then
npm i
npx tsc
npm publish
else
version_input="$(npm pkg get version | sed "s/\"//g")"
suffix_pattern="-alpha.[0-9]+"
if [[ ! "$version_input" =~ $suffix_pattern$ ]]; then
version="$version_input-alpha.$(date +%s)"
else
version="$version_input"
fi
npm version "$version" --allow-same-version
npm i
npx tsc
npm publish --tag alpha
fi
echo "version=$(npm pkg get version)" >> $GITHUB_OUTPUT