-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (63 loc) · 1.9 KB
/
Copy pathpublish-packages-github.yml
File metadata and controls
74 lines (63 loc) · 1.9 KB
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
name: Publish Packages (GitHub Packages)
on:
# push:
# branches:
# - master
# - main
# tags:
# - "v*"
workflow_dispatch:
concurrency:
group: publish-packages-github-${{ github.ref }}
cancel-in-progress: true
jobs:
# The package list comes from list-packages.sh so that it cannot drift from
# publish.sh. It used to be spelled out here, and four packages were missing.
list-packages:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.list.outputs.packages }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: List publishable packages
id: list
run: |
echo "packages=$(./list-packages.sh | jq -Rsc 'split("\n") | map(select(length > 0))')" >> "${GITHUB_OUTPUT}"
build-and-publish:
needs: list-packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
path: ${{ fromJSON(needs.list-packages.outputs.packages) }}
defaults:
run:
working-directory: ${{ matrix.path }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Configure GitHub Packages auth
run: |
cat <<EOF > ~/.npmrc
@${{ github.repository_owner }}:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
EOF
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Update dependencies
run: bun update
- name: Publish package
run: bun publish --registry https://npm.pkg.github.com/
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_TOKEN: ${{ secrets.GITHUB_TOKEN }}