-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (39 loc) · 1.35 KB
/
publish-beta.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
name: Publish beta package
on:
pull_request:
branches:
- master
jobs:
release:
runs-on: ubuntu-latest
# Only run this job if the PR is from a trusted collaborator (i.e. not a fork)
if: github.event.pull_request.head.repo.full_name == github.repository
env:
CEREBRUM_NPM_TOKEN: ${{ secrets.CEREBRUM_NPM_TOKEN }}
steps:
# Checkout project repository
- name: Checkout
uses: actions/checkout@v4
# Setup Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: 20
# Use a cache for dependencies
- uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
# Install dependencies so that prepublish scripts work as expected
- name: Install deps
run: npm i
# Update package version to a beta release, including the git commit sha
- name: Bump package.json
run: |
npm --no-git-tag-version version $(npm show . version)-beta.dangerous.$(git rev-parse --short HEAD)
# Publish version to npm
- name: Publish beta package
run: npm publish --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.CEREBRUM_PUBLISH_NPM_TOKEN }}