From 218a68950503ed0d0e6dc44e49980d641d596ce3 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 when push to develop (#1874) Co-authored-by: Julian Skinner --- .github/workflows/publish.yml | 31 ++++++++++++++++++++++------ .github/workflows/release-deploy.yml | 2 ++ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dbadfb46b8..81316be2f4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - develop jobs: lint-test-build: @@ -17,10 +18,6 @@ jobs: 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 }}' - - name: Add safe directory run: git config --global --add safe.directory /__w/sage-lib/sage-lib @@ -53,13 +50,35 @@ jobs: node-version: 18 registry-url: https://npm.pkg.github.com + # # Setup Auth token to push to github packages + - name: Set NPM Config + run: npm config set '//npm.pkg.github.com/:_authToken=${NPM_TOKEN}' + shell: bash + env: + NPM_TOKEN: ${{ secrets.ACCESS_TOKEN }} + - name: Yarn Install run: yarn install --frozen-lockfile - 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 version prepatch --yes --preid rc + - name: Lerna Publish run: NODE_OPTIONS=--openssl-legacy-provider yarn lerna publish --registry github --yes - env: - NODE_AUTH_TOKEN: ${{ secrets.ACCESS_TOKEN }} + + - name: Deploy Development + if: github.ref == 'refs/heads/develop' + uses: ./.github/workflows/release-deploy 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