-
-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (39 loc) · 1.44 KB
/
publish-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
name: Publish dev
on:
workflow_dispatch:
schedule:
- cron: '0 */12 * * *'
jobs:
npm:
name: npm
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Node v18
uses: actions/setup-node@v4.0.3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
cache: yarn
cache-dependency-path: yarn.lock
- name: Check previous released version
id: pre-release
run: |
if [[ $(npm view node-brawlstars@dev version | grep -e "$(jq --raw-output '.version' package.json)-dev.*.$(git rev-parse --short HEAD | cut -b1-3)") ]]; \
then echo '::set-output name=release::false'; \
else echo '::set-output name=release::true'; fi
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Deprecate old versions
if: steps.pre-release.outputs.release == 'true'
run: 'npx @favware/npm-deprecate --name "*dev*" --package "node-brawlstars"'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish
if: steps.pre-release.outputs.release == 'true'
run: |
npm version --git-tag-version=false $(jq --raw-output '.version' package.json)-dev.$(date +%s).$(git rev-parse --short HEAD)
npm run publish:dev || true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}