-
Notifications
You must be signed in to change notification settings - Fork 8
54 lines (44 loc) · 1.5 KB
/
deploy_pr.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
name: deploy_pr
on: pull_request
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 19
- name: Install npm dependencies
run: npm ci
- name: Run unit tests
run: npm run test:unit
- name: Run integration tests
run: npm run test:integration
publish-gpr:
needs: test
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 19
registry-url: https://npm.pkg.github.com/
- name: Install npm dependencies
run: npm ci
- name: Build package
run: npm run build
- name: Update package version
run: |
SHORT_SHA=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}")
CURRENT_PACKAGE_VERSION=$(cat package.json | jq -r '.version')
npm version "${CURRENT_PACKAGE_VERSION}-pr${{ github.event.number }}.${SHORT_SHA}" --no-git-tag-version
- name: Publish package
run: |
echo "$(jq '.publishConfig.registry = "https://npm.pkg.github.com"' package.json)" > package.json
echo "$( jq '.name = "@IQSS/dataverse-client-javascript"' package.json )" > package.json
npm publish --@IQSS:registry=https://npm.pkg.github.com
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}