forked from Nekonyx/next-auth-steam
-
Notifications
You must be signed in to change notification settings - Fork 4
62 lines (53 loc) · 2.12 KB
/
publish-next-auth-steam.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
name: Release to npm
on:
push:
paths:
- 'package.json'
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ./.npmrc
npm ci
- name: Get previous version
id: get_previous_version
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ./.npmrc
npm view @hyperplay/next-auth-steam version --verbose
echo ::set-output name=previous_version::$(npm view @hyperplay/next-auth-steam version | tr -d '[:space:]')
- name: Set current version
id: set_current_version
run: echo ::set-output name=current_version::$(node -p "require('./package.json').version")
- name: Compare versions
id: compare_versions
env:
PREVIOUS_VERSION: ${{ steps.get_previous_version.outputs.previous_version }}
CURRENT_VERSION: ${{ steps.set_current_version.outputs.current_version }}
run: echo ::set-output name=do_release::$(node -p "Number(process.env.INPUT_FORCE_RELEASE) || require('semver/functions/gt')(process.env.CURRENT_VERSION, process.env.PREVIOUS_VERSION)")
- name: Build @hyperplay/next-auth-steam
if: steps.compare_versions.outputs.do_release == 'true'
run: |
npm run build
- name: Release to npm
if: steps.compare_versions.outputs.do_release == 'true'
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ./.npmrc
if [[ ${{ steps.set_current_version.outputs.current_version }} == *"-alpha"* ]]; then
npm publish --tag alpha
elif [[ ${{ steps.set_current_version.outputs.current_version }} == *"-beta"* ]]; then
npm publish --tag beta
else
npm publish
fi;