generated from wabarc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 3
88 lines (81 loc) · 2.49 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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Copyright 2023 Wayback Archiver. All rights reserved.
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file.
name: Publish
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
prepare:
if: github.repository == 'wabarc/cairn'
runs-on: ubuntu-latest
name: Prepare
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn install
- run: yarn run test
- run: yarn run build
- run: rm -rf node_modules/
- name: Upload package
uses: actions/upload-artifact@v2
with:
name: package
path: .
publish-npm:
runs-on: ubuntu-latest
name: Publish to NPM
needs: prepare
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Download math result from prepare job
uses: actions/download-artifact@v2
with:
name: package
path: package
- name: Checkout package directory and publish
run: |
cd package
yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-gh:
runs-on: ubuntu-latest
name: Publish to GitHub
needs: prepare
permissions:
packages: write
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: '18.x'
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@wabarc'
- name: Download math result from prepare job
uses: actions/download-artifact@v2
with:
name: package
path: package
- name: Checkout package directory and publish
run: |
cd package
yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}