Skip to content

Commit 6c3b301

Browse files
committed
refactor: manually publish production releases from release branch only
1 parent 1399fea commit 6c3b301

File tree

3 files changed

+68
-4
lines changed

3 files changed

+68
-4
lines changed

.github/workflows/gh-pages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: 'Run typedoc and publish to pages'
22

33
on:
4-
push:
5-
branches:
6-
- main
4+
workflow_call:
5+
workflow_dispatch:
6+
77
jobs:
88
build-and-publish-docs:
99
runs-on: ubuntu-latest

.github/workflows/prod-release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Prod Publish
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
prod_release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Generate bot token
14+
uses: actions/create-github-app-token@v1
15+
id: app_token
16+
with:
17+
app-id: ${{ secrets.BOT_ID }}
18+
private-key: ${{ secrets.BOT_SK }}
19+
20+
- uses: actions/checkout@v4
21+
with:
22+
# Fetch entire repository history so we can determine version number from it
23+
fetch-depth: 0
24+
token: ${{ steps.app_token.outputs.token }}
25+
26+
- name: Set Git user as GitHub actions
27+
run: git config --global user.email "179917785+engineering-ci[bot]@users.noreply.github.com" && git config --global user.name "engineering-ci[bot]"
28+
29+
- name: Merge main -> release
30+
uses: devmasx/merge-branch@854d3ac71ed1e9deb668e0074781b81fdd6e771f
31+
with:
32+
type: now
33+
from_branch: main
34+
target_branch: release
35+
github_token: ${{ steps.app_token.outputs.token }}
36+
37+
- name: Merge release -> main
38+
uses: devmasx/merge-branch@854d3ac71ed1e9deb668e0074781b81fdd6e771f
39+
with:
40+
type: now
41+
from_branch: release
42+
target_branch: main
43+
message: Merge release back to main to get version increment [no ci]
44+
github_token: ${{ steps.app_token.outputs.token }}

.github/workflows/release.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
- main
88
- release
99
workflow_dispatch:
10+
inputs:
11+
publish-prod-release:
12+
description: "Publishing a production release? If false (default), won't create a production release."
13+
type: boolean
14+
required: false
15+
default: false
1016

1117
concurrency: release
1218

@@ -15,6 +21,9 @@ permissions:
1521
issues: write
1622
pull-requests: write
1723

24+
env:
25+
PUBLISH_RELEASE: ${{ (github.ref_name != 'release' || inputs.publish-prod-release) && 'true' || 'false' }}
26+
1827
jobs:
1928
build:
2029
name: 'Build @algorandfoundation/algorand-typescript-testing'
@@ -67,10 +76,21 @@ jobs:
6776
GITHUB_TOKEN: ${{ steps.app_token.outputs.token }}
6877

6978
- name: Publish @algorandfoundation/algorand-typescript-testing
79+
if: ${{ env.PUBLISH_RELEASE == 'true' }}
7080
uses: JS-DevTools/npm-publish@v3
7181
with:
7282
token: ${{ secrets.NPM_TOKEN }}
7383
package: artifacts/algo-ts-testing/package.json
7484
access: 'public'
7585
# Tagging 'main' branch with latest for now, even though it's beta because we don't have a non-beta
76-
tag: ${{ github.ref_name == 'alpha' && 'alpha' || github.ref_name == 'main' && 'latest' || github.ref_name == 'release' && 'latest' || 'pre-release' }}
86+
tag: ${{ github.ref_name == 'alpha' && 'alpha' || github.ref_name == 'main' && 'beta' || github.ref_name == 'release' && 'latest' || 'pre-release' }}
87+
88+
publish-docs:
89+
name: Publish docs
90+
needs: release
91+
if: ${{ inputs.publish-prod-release }}
92+
uses: ./.github/workflows/gh-pages.yml
93+
permissions:
94+
contents: read
95+
pages: write
96+
id-token: write

0 commit comments

Comments
 (0)