Skip to content

Commit 3359401

Browse files
ci: modify workflow to deploy to Develop or Staging ECR based on branch
name (#1874) Co-authored-by: Julian Skinner <dev+github-bot@kajabi.com>
1 parent d8aad0d commit 3359401

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

.github/workflows/publish.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- develop
78

89
jobs:
910
lint-test-build:
@@ -12,14 +13,11 @@ jobs:
1213
publish:
1314
needs: [lint-test-build]
1415
runs-on: ubuntu-latest
15-
outputs:
16-
postfix: ${{ env.postfix }}
17-
gitsha: ${{ steps.gitsha.outputs.value }}
1816

1917
steps:
2018
# # Setup Auth token to push to github packages
2119
- name: Set NPM Config
22-
run: npm config set '//npm.pkg.github.com/:_authToken' '${{ secrets.ACCESS_TOKEN }}'
20+
run: npm config set '//npm.pkg.github.com/:_authToken=${{ secrets.ACCESS_TOKEN }}'
2321

2422
- name: Add safe directory
2523
run: git config --global --add safe.directory /__w/sage-lib/sage-lib
@@ -59,7 +57,29 @@ jobs:
5957
- name: Lerna Boostrap
6058
run: yarn lerna bootstrap --ci
6159

60+
- name: Set PreId
61+
id: set_preid
62+
run: |
63+
if [ "${{ github.ref }}" == "refs/heads/develop" ]; then
64+
echo "preid='rc'" >> $GITHUB_OUTPUT
65+
else
66+
echo "preid=''" >> $GITHUB_OUTPUT
67+
fi
68+
69+
- name: Lerna Version Develop
70+
if: github.ref == 'refs/heads/develop'
71+
run: NODE_OPTIONS=--openssl-legacy-provider yarn lerna publish --canary --yes --preid rc
72+
env:
73+
NODE_AUTH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
74+
6275
- name: Lerna Publish
76+
if: github.ref == 'refs/heads/main'
6377
run: NODE_OPTIONS=--openssl-legacy-provider yarn lerna publish --registry github --yes
6478
env:
6579
NODE_AUTH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
80+
81+
deploy:
82+
needs: publish
83+
if: github.ref == 'refs/heads/develop'
84+
uses: ./.github/workflows/release-deploy.yml
85+
secrets: inherit

.github/workflows/release-deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ name: Release-Deploy
22
on:
33
# !!Emergency override!! uncomment below and access the actions tab in GitHub to run a release/deploy
44
# workflow_dispatch:
5+
workflow_call:
56
release:
67
types: [published]
78

9+
810
jobs:
911
lint-test-build:
1012
uses: ./.github/workflows/lint-test-build.yml

0 commit comments

Comments
 (0)