-
Notifications
You must be signed in to change notification settings - Fork 2
114 lines (104 loc) · 3.85 KB
/
publish.yaml
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
jsr:
name: Publish @styra/opa to JSR
runs-on: ubuntu-22.04
needs:
- release
if: contains(fromJSON(needs.release.outputs.publishedPackages).*.name, '@styra/opa')
permissions:
contents: read
id-token: write # OIDC ID token for authentication with JSR
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 22
- name: publish @styra/opa to JSR
run: |
npm ci
npx -w packages/opa jsr publish
release:
name: Release
outputs:
published: ${{ steps.changesets.outputs.published }}
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
runs-on: ubuntu-22.04
permissions:
contents: write # to create release (changesets/action)
actions: write # to create tags (changesets/action)
issues: write # to post issue comments (changesets/action)
pull-requests: write # to create pull request (changesets/action)
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 22
- name: Install Dependencies
run: |
npm ci
npm run build --ws
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: StyraInc/changesets-action@aba318e9165b45b7948c60273e0b72fce0a64eb9 # v1.4.7
with:
publish: npm run publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Process results
id: opa_pkg
run: |
echo "tag=$(jq -nr --argjson pkgs $PP '$pkgs[] | select(.name == "@styra/opa") | (.name + "@" + .version)')" >> $GITHUB_OUTPUT
echo "included=$(jq -nr --argjson pkgs $PP '$pkgs[] | select(.name == "@styra/opa") | true')" >> $GITHUB_OUTPUT
echo "version=$(jq -nr --argjson pkgs $PP '$pkgs[] | select(.name == "@styra/opa") | .version')" >> $GITHUB_OUTPUT
env:
PP: ${{ steps.changesets.outputs.publishedPackages }}
- name: Generate @styra/opa GH release notes
run: build/opa-release-notes.sh > OPA_RELEASE_NOTES.md
if: steps.opa_pkg.outputs.included == 'true'
env:
VERSION: ${{ steps.opa_pkg.outputs.version }}
- name: Create @styra/opa GH release
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
if: steps.opa_pkg.outputs.included == 'true'
with:
body_path: OPA_RELEASE_NOTES.md
tag_name: ${{ steps.opa_pkg.outputs.tag }}
docs:
name: Publish Docs
needs:
- release
if: needs.release.outputs.published == 'true'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
actions: read
pages: write
id-token: write
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 22
- name: Install dependencies
run: |
npm ci
npm run build --ws
- name: Generate docs
run: npm run docs
- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
# Upload entire repository
path: docs/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5