Skip to content

Commit

Permalink
ci: modify workflow to deploy to Develop or Staging ECR based on branch
Browse files Browse the repository at this point in the history
name (#1874)

Co-authored-by: Julian Skinner <[email protected]>
  • Loading branch information
ju-Skinner and kajabi-bot committed Mar 26, 2024
1 parent d8aad0d commit 3359401
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- develop

jobs:
lint-test-build:
Expand All @@ -12,14 +13,11 @@ jobs:
publish:
needs: [lint-test-build]
runs-on: ubuntu-latest
outputs:
postfix: ${{ env.postfix }}
gitsha: ${{ steps.gitsha.outputs.value }}

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

- name: Add safe directory
run: git config --global --add safe.directory /__w/sage-lib/sage-lib
Expand Down Expand Up @@ -59,7 +57,29 @@ jobs:
- name: Lerna Boostrap
run: yarn lerna bootstrap --ci

- name: Set PreId
id: set_preid
run: |
if [ "${{ github.ref }}" == "refs/heads/develop" ]; then
echo "preid='rc'" >> $GITHUB_OUTPUT
else
echo "preid=''" >> $GITHUB_OUTPUT
fi
- name: Lerna Version Develop
if: github.ref == 'refs/heads/develop'
run: NODE_OPTIONS=--openssl-legacy-provider yarn lerna publish --canary --yes --preid rc
env:
NODE_AUTH_TOKEN: ${{ secrets.ACCESS_TOKEN }}

- name: Lerna Publish
if: github.ref == 'refs/heads/main'
run: NODE_OPTIONS=--openssl-legacy-provider yarn lerna publish --registry github --yes
env:
NODE_AUTH_TOKEN: ${{ secrets.ACCESS_TOKEN }}

deploy:
needs: publish
if: github.ref == 'refs/heads/develop'
uses: ./.github/workflows/release-deploy.yml
secrets: inherit
2 changes: 2 additions & 0 deletions .github/workflows/release-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: Release-Deploy
on:
# !!Emergency override!! uncomment below and access the actions tab in GitHub to run a release/deploy
# workflow_dispatch:
workflow_call:
release:
types: [published]


jobs:
lint-test-build:
uses: ./.github/workflows/lint-test-build.yml
Expand Down

0 comments on commit 3359401

Please sign in to comment.