Skip to content

Commit 03b3779

Browse files
author
Christopher J Baker
authored
Update v2 (#93)
1 parent e186160 commit 03b3779

File tree

2 files changed

+55
-47
lines changed

2 files changed

+55
-47
lines changed

.github/workflows/publish.yml renamed to .github/workflows/verify-and-publish.yml

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
name: Publish
1+
name: Verify and Publish
22

33
on:
4+
push:
45
workflow_dispatch:
56
inputs:
67
segment:
@@ -10,37 +11,77 @@ on:
1011
description: "Appended to the pre-release segment. (default: \"\")"
1112

1213
jobs:
13-
build:
14+
verify:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
21+
- name: Setup Node.js environment
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version-file: ".nvmrc"
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Typecheck
30+
run: npm run typecheck
31+
- name: ESLint
32+
run: npm run eslint
33+
- name: Prettier
34+
run: npm run prettier
35+
- name: depcheck
36+
run: npm run depcheck
37+
38+
- name: Test
39+
run: npm run buildtests && npm run test
40+
41+
- name: Build
42+
run: npm run build
43+
44+
publish:
45+
if: github.event_name == 'workflow_dispatch'
46+
needs: verify
47+
48+
concurrency:
49+
group: "publish"
50+
cancel-in-progress: false
51+
1452
runs-on: ubuntu-latest
1553
permissions:
1654
contents: write
1755
packages: write
1856

1957
steps:
2058
- name: Checkout
21-
uses: actions/checkout@v2
59+
uses: actions/checkout@v3
2260

23-
- name: Use Node.js
24-
uses: actions/setup-node@v2
61+
- name: Setup Node.js environment
62+
uses: actions/setup-node@v3
2563
with:
26-
node-version: "16"
64+
node-version-file: ".nvmrc"
2765

28-
- name: "Install"
66+
- name: Install dependencies
2967
run: npm ci
3068

31-
- name: "Build"
32-
run: npm run build
33-
34-
- name: "Test"
35-
run: npm run buildtests && npm run test
69+
- name: Determine Tag
70+
id: tag
71+
run: |
72+
if [[ ${{ github.event.inputs.segment }} == pre* ]]; then
73+
echo "tag=next" >> $GITHUB_OUTPUT
74+
else
75+
echo "tag=latest" >> $GITHUB_OUTPUT
76+
fi
3677
3778
- name: Increment Version
3879
run: |
3980
git config --local user.email "Workflow: ${{ env.GITHUB_WORKFLOW }}[bot]"
4081
git config --local user.name "${{ env.GITHUB_WORKFLOW }}[bot]@workflow"
4182
4283
if [[ ${{ github.event.inputs.segment }} == pre* ]]; then
43-
PRE_ID="${{ github.event.inputs.preId}}"
84+
PRE_ID="${{ github.event.inputs.preId }}"
4485
if [[ -n "$PRE_ID" ]]; then
4586
PRE_ID_COMMAND_STR="--preid $PRE_ID"
4687
fi
@@ -52,6 +93,7 @@ jobs:
5293
uses: JS-DevTools/npm-publish@v1
5394
with:
5495
token: ${{ secrets.NPM_TOKEN }}
96+
tag: ${{ steps.tag.outputs.tag }}
5597

5698
- name: Push Tag
5799
uses: ad-m/github-push-action@master

.github/workflows/verify.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)