-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (73 loc) · 2.35 KB
/
release-dev.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
name: Dev release
on:
workflow_call:
secrets:
pullPrivatePackagesPAT:
required: true
jobs:
build-and-package:
runs-on: ubuntu-latest
outputs:
package-version: ${{ steps.set-package-version.outputs.version }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Set GITHUB_PAT in env for pulling private packages
run: echo "GITHUB_PAT=${{ secrets.pullPrivatePackagesPAT }}" >> $GITHUB_ENV
- name: 'Yarn and setup'
run: |
cat package.json
yarn
yarn build
cp package.json ./dist/package.json
- name: Set PACKAGE_VERSION in env
run: echo "PACKAGE_VERSION=0.0.0-dev.$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Set new PACKAGE_VERSION in job outputs
id: set-package-version
run: echo "version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
- name: Npm version
run: |
echo $PACKAGE_VERSION
npm version $PACKAGE_VERSION --no-git-tag-version
npm pack
working-directory: ./dist
- name: Upload
uses: actions/upload-artifact@v4
with:
name: package
path: './dist/*.tgz'
publish:
needs: build-and-package
runs-on: ubuntu-latest
if: github.repository_owner == 'srgssr'
steps:
- name: Upload
uses: actions/download-artifact@v4
with:
name: package
- uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: https://npm.pkg.github.com/
scope: '@srgssr'
- run: echo "@srgssr:registry=https://npm.pkg.github.com" >> .npmrc
- run: npm publish $(ls *.tgz)
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
comment-version-in-pr:
runs-on: ubuntu-latest
needs: [build-and-package, publish]
steps:
- name: Downcase repository name
run: |
echo "REPO=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
- name: Comment with version
uses: thollander/actions-comment-pull-request@v1
with:
message: '"@${{ env.REPO }}": "${{ needs.build-and-package.outputs.package-version }}",'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}