-
Notifications
You must be signed in to change notification settings - Fork 22
40 lines (40 loc) · 1.19 KB
/
publish.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
name: publish
on:
push:
branches:
- master
tags:
- "!*"
jobs:
release:
name: Setup
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://npm.pkg.github.com'
- name: install
run: npm install
- name: test
run: npm test
# Publish to npm if this version is not published
- name: Publish
run: |
npx can-npm-publish --yes --verbose && npm publish || echo "Does not publish"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Push tag to GitHub if the version's tag is not tagged
- name: set PACKAGE_VERSION
run: node -p -e '`PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV
- name: package-version-to-git-tag
uses: pkgdeps/git-tag-action@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_repo: ${{ github.repository }}
version: ${{ env.PACKAGE_VERSION }}
git_commit_sha: ${{ github.sha }}
git_tag_prefix: "apps/test/v"