Repository navigation
90 lines (84 loc) · 2.96 KB
/
Copy pathrelease.yaml
File metadata and controls
90 lines (84 loc) · 2.96 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Release
on:
push:
branches:
- main
- v2.0.0
workflow_dispatch:
env:
FORCE_COLOR: true
permissions: {}
concurrency:
group: release
cancel-in-progress: false
jobs:
release:
name: Release
runs-on: ubuntu-latest
if: ${{ github.repository == 'PaloAltoNetworks/docusaurus-openapi-docs' }}
environment: release
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: true # scripts/publish.ts pushes tags via git
- run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22"
- name: Upgrade npm for OIDC trusted publishing
run: npm install -g npm@latest
- name: Install dependencies
run: yarn --frozen-lockfile --prefer-offline --ignore-scripts
- name: Release
run: yarn ts-node --transpile-only scripts/publish.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
canary:
name: Publish Canary
runs-on: ubuntu-latest
if: ${{ github.repository == 'PaloAltoNetworks/docusaurus-openapi-docs' && github.ref == 'refs/heads/main' }}
environment: release
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Check if packages changed
id: packages_changed
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] || git diff --name-only HEAD~1 HEAD | grep -q "^packages/"; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Set up Node
if: steps.packages_changed.outputs.changed == 'true'
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22"
- name: Upgrade npm for OIDC trusted publishing
if: steps.packages_changed.outputs.changed == 'true'
run: npm install -g npm@latest
- name: Prepare git
if: steps.packages_changed.outputs.changed == 'true'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch
git checkout main
- name: Installation
if: steps.packages_changed.outputs.changed == 'true'
run: yarn --frozen-lockfile --prefer-offline --ignore-scripts && yarn build-packages
- name: Publish Canary release
if: steps.packages_changed.outputs.changed == 'true'
run: yarn canary