-
Notifications
You must be signed in to change notification settings - Fork 567
89 lines (86 loc) · 3.74 KB
/
Copy pathrelease.yml
File metadata and controls
89 lines (86 loc) · 3.74 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
name: Release
permissions: {}
on:
workflow_dispatch:
inputs:
releaseVersion:
type: string
required: true
description: The version of this release. Must be a semantic version of the form X.Y.Z.
dry_run:
type: boolean
required: true
default: false
description: Dry run, will not push branches or upload the artifacts.
skip_tag:
type: boolean
required: true
default: false
description: If true, don't tag this release, just push it.
pre_release:
type: boolean
required: true
default: false
description: If true, mark this as a pre-release
jobs:
release:
runs-on: ubuntu-latest
environment: production
permissions:
contents: write # Push tags to the repository
actions: write # Trigger downstream workflows
id-token: write # npm provenance via OIDC
steps:
- name: Checkout Javascript
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '26'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm install
- name: Package
run: ./build-package.sh
- name: Upload release
if: ${{ github.event.inputs.dry_run != 'true' && github.event.inputs.pre_release != 'true' }}
run: npm publish --tag latest
- name: Upload pre-release
if: ${{ github.event.inputs.dry_run != 'true' && github.event.inputs.pre_release == 'true' }}
run: npm publish --tag next
- name: Tag release
if: ${{ github.event.inputs.skip_tag != 'true' }}
run: |
git config --global user.name 'Github Bot'
git config --global user.email '<>'
git tag "${RELEASE_VERSION}"
env:
RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }}
- name: Push tag
if: ${{ github.event.inputs.dry_run != 'true' }}
run: |
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
git push origin "${RELEASE_VERSION}"
env:
RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install docs dependencies
run: cd docs && npm ci
- name: Run prebuild
run: cd docs && npm run prebuild
- name: Create version snapshot
run: cd docs && npx docusaurus docs:version "${RELEASE_VERSION}"
env:
RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }}
- name: Commit versioned docs
if: ${{ github.event.inputs.dry_run != 'true' }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/versions.json docs/versioned_docs/ docs/versioned_sidebars/
git commit -m "docs: snapshot version ${REF_NAME}" || echo "No changes to commit"
git push
env:
REF_NAME: ${{ github.ref_name }}