-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (60 loc) · 1.87 KB
/
main-workflow.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
52
53
54
55
56
57
58
59
60
61
62
63
name: Main workflow
on:
push:
branches:
- main
paths:
- "src/*"
- "**.js"
- "**.ts"
- "**.json"
jobs:
get_version:
name: Retrieve version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.package_version.outputs.version }}
steps:
- uses: zendesk/checkout@v4
- name: Get Package version
id: package_version
run: |
echo "Reading package.json"
PACKAGE_VERSION=$(cat ./package.json | jq '.version' | tr -d '"')
echo "version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
create-release:
name: Create release
runs-on: ubuntu-latest
needs:
- get_version
env:
VERSION: ${{ needs.get_version.outputs.version }}
GH_TOKEN: ${{ github.token }}
steps:
- name: Create release
run: |
gh release create ${{ env.VERSION }} -R '${{ github.repository }}' --generate-notes
release:
name: Release package on Github Packages
runs-on: ubuntu-latest
needs:
- create-release
permissions:
packages: write
contents: read
steps:
- uses: zendesk/checkout@v4
- uses: zendesk/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: "package-lock.json"
registry-url: https://npm.pkg.github.com/
- name: Install dependencies
run: npm ci
- name: Build package
run: npm run build
- name: Publish to Github Packages
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}