From 33594016ddebbfd8333301fca31ffa3cba99eb3e Mon Sep 17 00:00:00 2001 From: Julian Skinner Date: Wed, 20 Mar 2024 09:41:31 -0500 Subject: [PATCH] ci: modify workflow to deploy to Develop or Staging ECR based on branch name (#1874) Co-authored-by: Julian Skinner --- .github/workflows/publish.yml | 28 ++++++++++++++++++++++++---- .github/workflows/release-deploy.yml | 2 ++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dbadfb46b8..c43aef891a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - develop jobs: lint-test-build: @@ -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 @@ -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 diff --git a/.github/workflows/release-deploy.yml b/.github/workflows/release-deploy.yml index 0ce0df75f2..a23b7f7870 100644 --- a/.github/workflows/release-deploy.yml +++ b/.github/workflows/release-deploy.yml @@ -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