generated from sapphiredev/sapphire-template
-
-
Notifications
You must be signed in to change notification settings - Fork 38
86 lines (81 loc) · 2.54 KB
/
continuous-delivery.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
name: Continuous Delivery
on:
workflow_dispatch:
inputs:
prNumber:
description: The number of the PR that is being deployed
required: true
ref:
description: The branch that is being deployed. Should be a branch on the given repository
required: false
default: main
repository:
description: The {owner}/{repository} that is being deployed.
required: false
default: sapphiredev/utilities
push:
branches:
- main
jobs:
publish:
name: Publish Next to npm
runs-on: ubuntu-latest
if: github.repository_owner == 'sapphiredev'
strategy:
fail-fast: false
matrix:
package:
- async-queue
- bitfield
- cron
- decorators
- discord-utilities
- discord.js-utilities
- duration
- eslint-config
- eslint-plugin-result
- event-iterator
- fetch
- iterator-utilities
- lexure
- node-utilities
- phisherman
- ratelimits
- result
- snowflake
- stopwatch
- string-store
- time-utilities
- timer-manager
- timestamp
- ts-config
- utilities
steps:
- name: Checkout Project
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: ${{ github.event.inputs.repository || 'sapphiredev/utilities' }}
ref: ${{ github.event.inputs.ref || 'main' }}
- name: Use Node.js v20
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
registry-url: https://registry.yarnpkg.com/
- name: Install Dependencies
run: yarn --immutable
- name: Build all packages
run: yarn build
- name: Bump Versions & Publish
working-directory: packages/${{ matrix.package }}
run: |
# Resolve the tag to be used. "next" for push events, "pr-{prNumber}" for dispatch events.
TAG=$([[ ${{ github.event_name }} == 'push' ]] && echo 'next' || echo 'pr-${{ github.event.inputs.prNumber }}')
yarn config set npmAuthToken ${NODE_AUTH_TOKEN}
yarn config set npmPublishRegistry "https://registry.yarnpkg.com"
yarn bump --preid "${TAG}.$(git rev-parse --verify --short HEAD)" --skip-changelog
yarn npm publish --tag ${TAG}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}