Repository navigation
85 lines (82 loc) · 3.79 KB
/
Copy pathpublish.yml
File metadata and controls
85 lines (82 loc) · 3.79 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
name: Release packages
on:
workflow_dispatch:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
# Use the PAT for git operations so the release PR update can trigger CI.
token: ${{ secrets.CHANGESETS_BOT_TOKEN }}
- name: Enable corepack
run: corepack enable
- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
cache: "yarn"
cache-dependency-path: "**/yarn.lock"
registry-url: "https://registry.npmjs.org"
scope: "@reflag"
- name: Install dependencies
run: yarn install --immutable
- name: Determine release channel
id: release-channel
run: node scripts/release-channel.mjs >> "$GITHUB_OUTPUT"
- name: Create release PR or publish packages
id: changesets
uses: changesets/action@v1
with:
version: yarn version-packages
publish: yarn release-packages
title: Version Packages
commit: Version Packages
env:
GITHUB_TOKEN: ${{ secrets.CHANGESETS_BOT_TOKEN }}
- name: Select released SDK documentation
if: steps.changesets.outputs.published == 'true' && steps.release-channel.outputs.prerelease == 'false'
id: docs
env:
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
run: node scripts/docs-release-plan.mjs "$RUNNER_TEMP/sdk-docs-plan.json"
- name: Checkout docs with SSH
if: steps.changesets.outputs.published == 'true' && steps.release-channel.outputs.prerelease == 'false' && steps.docs.outputs.has_docs == 'true'
uses: actions/checkout@v4
with:
repository: reflagcom/docs
ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }}
path: reflag-docs
- name: Hold docs sync until the public v1/v2 content cutover
if: steps.changesets.outputs.published == 'true' && steps.release-channel.outputs.prerelease == 'false' && steps.docs.outputs.has_docs == 'true'
id: docs-site
run: node reflag-docs/.github/scripts/sdk-docs.mjs ready --destination reflag-docs | tee -a "$GITHUB_OUTPUT"
- name: Build docs
if: steps.changesets.outputs.published == 'true' && steps.release-channel.outputs.prerelease == 'false' && steps.docs-site.outputs.ready == 'true'
run: yarn docs
- name: Sync only released packages and majors
if: steps.changesets.outputs.published == 'true' && steps.release-channel.outputs.prerelease == 'false' && steps.docs-site.outputs.ready == 'true'
run: node reflag-docs/.github/scripts/sdk-docs.mjs release --source . --destination reflag-docs --plan "$RUNNER_TEMP/sdk-docs-plan.json"
- name: Check generated documentation
if: steps.changesets.outputs.published == 'true' && steps.release-channel.outputs.prerelease == 'false' && steps.docs-site.outputs.ready == 'true'
working-directory: reflag-docs
run: node .github/scripts/check-sdk-docs.mjs
- name: Commit and push changes
if: steps.changesets.outputs.published == 'true' && steps.release-channel.outputs.prerelease == 'false' && steps.docs-site.outputs.ready == 'true'
working-directory: reflag-docs
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@reflag.com"
git add supported-languages legacy api sdk .generated/sdk-docs
if ! git diff --cached --quiet; then
git commit -m "Update released SDK documentation"
git push
fi