-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (57 loc) · 1.73 KB
/
main.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
name: Build and Publish
on:
workflow_dispatch:
inputs:
version-increment:
description: version update
default: patch
required: true
jobs:
build_and_publish:
name: Build & Publish
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
token: ${{ secrets.BOT_PAT }}
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: "14"
registry-url: "https://registry.npmjs.org"
cache: "npm"
- run: npm i -g npm@8
- name: Increment Version
run: |
git config user.email "action@github.com"
git config user.name "Nova Bot"
npm version --workspaces --include-workspace-root ${{ github.event.inputs.version-increment }}
- name: Build
run: |
npm ci
npm run build
- name: Publish
run: |
cd build
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Get Tag
id: git-tag
run: echo "::set-output name=result::$(git describe --tags)"
- name: Upload Release
uses: actions/upload-artifact@v2
with:
name: release-artifact-${{ steps.git-tag.outputs.result }}
path: build/**/*
- name: Push Version Change
env:
GITHUB_TOKEN: ${{ secrets.BOT_PAT }}
run: |
git add .
git commit --amend --no-edit
git tag -d ${{ steps.git-tag.outputs.result }}
git tag ${{ steps.git-tag.outputs.result }}
git push origin ${GITHUB_REF#refs/heads/}
git push origin ${{ steps.git-tag.outputs.result }}