forked from athombv/node-homey-log
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (59 loc) · 2.15 KB
/
deploy.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
name: Deploy
on:
push:
branches:
- master
jobs:
check_if_sentry_updated:
name: Check whether Sentry was updated
outputs:
version_ok: ${{ steps.check.outputs.version_ok }}
sentry_version: ${{ steps.check.outputs.sentry_version }}
runs-on: ubuntu-latest
steps:
- name: Checkout git repository
uses: actions/checkout@v4
- name: Check whether Sentry was updated
id: check
run: |
sentryVersion="$(jq -r '.devDependencies."@sentry/node"' package.json)"
echo "version_ok=$(jq -r ".version == \"$sentryVersion\"" package.json)" >> $GITHUB_OUTPUT
echo "sentry_version=$sentryVersion" >> $GITHUB_OUTPUT
update_package_version:
name: Update package version if Sentry was updated
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
needs: check_if_sentry_updated
if: needs.check_if_sentry_updated.outputs.version_ok == 'false'
steps:
- name: Checkout git repository
uses: actions/checkout@v4
- name: Set up node 18 environment
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- name: Update package.json, commit and push
run: |
updatedManifest=$(jq ".version = \"${{ needs.check_if_sentry_updated.outputs.sentry_version }}\"" package.json)
echo -E "${updatedManifest}" > package.json
git config --global user.name 'Action User'
git config --global user.email '[email protected]'
git add package.json
git commit -m "Bump version to ${{ needs.check_if_sentry_updated.outputs.sentry_version }}"
git push
- name: Build
run: |
npm ci
npm run build
- name: Publish
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
- name: Generate Github Release
uses: softprops/action-gh-release@v2
with:
make_latest: true
tag_name: v${{ needs.check_if_sentry_updated.outputs.sentry_version }} # update with known version