Skip to content

Commit

Permalink
Merge pull request #54 from Sage-Bionetworks/develop
Browse files Browse the repository at this point in the history
Fix CI/CD workflow broken during upgrade
  • Loading branch information
tschaffter committed Aug 19, 2021
2 parents a9be7ff + 32faeb8 commit 6125dfe
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
32 changes: 22 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ jobs:
buld-and-publish-package:
needs: [test]
runs-on: ubuntu-latest
if: env.push == 'true'
steps:
- uses: actions/checkout@v2

Expand All @@ -116,18 +115,22 @@ jobs:
run: cat .github_env >> $GITHUB_ENV

- name: Setup Node.js ${{ env.node_version }}
if: env.push == 'true'
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}
registry-url: 'https://registry.npmjs.org'

- name: Install npm dependencies
if: env.push == 'true'
run: npm ci

- name: Build package
if: env.push == 'true'
run: npm run build

- name: Push package to npmjs
if: env.push == 'true'
run: |
cp README.md dist/sage-angular/.
cd dist/sage-angular
Expand All @@ -141,6 +144,15 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Download .github_env
uses: actions/download-artifact@v2
with:
name: GITHUB_ENV
path: .

- name: Restore $GITHUB_ENV
run: cat .github_env >> $GITHUB_ENV

- name: Use Node.js ${{ env.node_version }}
uses: actions/setup-node@v2
with:
Expand All @@ -149,10 +161,10 @@ jobs:
- name: Install dependencies
run: |
npm ci
# npm install -g @angular/cli
npm install -g @angular/cli
- name: Build sage-angular-demo
run: ng build sage-angular-demo --configuration production --baseHref="${{ env.gh_pages_url }}/${{ steps.prep.outputs.version }}/demo/"
run: ng build sage-angular-demo --configuration production --baseHref="${{ env.gh_pages_url }}/${{ env.version }}/demo/"

- name: Build storybook
run: npm run build:storybook
Expand All @@ -163,15 +175,15 @@ jobs:
--branch gh-pages --single-branch gh-pages
# Update gh-pages: version specified
STORYBOOK_TARGET_DIR=gh-pages/${{ steps.prep.outputs.version }}/storybook
STORYBOOK_TARGET_DIR=gh-pages/${{ env.version }}/storybook
mkdir -p ${STORYBOOK_TARGET_DIR}
cp -R storybook-static/* ${STORYBOOK_TARGET_DIR}
DEMO_TARGET_DIR=gh-pages/${{ steps.prep.outputs.version }}/demo
DEMO_TARGET_DIR=gh-pages/${{ env.version }}/demo
mkdir -p ${DEMO_TARGET_DIR}
cp -R dist/sage-angular-demo/* ${DEMO_TARGET_DIR}
# Update gh-pages: latest, major, and minor versions
if [ ! -z "${{ steps.prep.outputs.version_major }}" ]; then
if [ ! -z "${{ env.version_major }}" ]; then
# Update major version (e.g. "1.2.3" => "1")
STORYBOOK_TARGET_DIR=gh-pages/latest/storybook
mkdir -p ${STORYBOOK_TARGET_DIR}
Expand All @@ -181,18 +193,18 @@ jobs:
cp -R dist/sage-angular-demo/* ${DEMO_TARGET_DIR}
# Update major version (e.g. "1.2.3" => "1")
STORYBOOK_TARGET_DIR=gh-pages/${{ steps.prep.outputs.version_major }}/storybook
STORYBOOK_TARGET_DIR=gh-pages/${{ env.version_major }}/storybook
mkdir -p ${STORYBOOK_TARGET_DIR}
cp -R storybook-static/* ${STORYBOOK_TARGET_DIR}
DEMO_TARGET_DIR=gh-pages/${{ steps.prep.outputs.version_major }}/demo
DEMO_TARGET_DIR=gh-pages/${{ env.version_major }}/demo
mkdir -p ${DEMO_TARGET_DIR}
cp -R dist/sage-angular-demo/* ${DEMO_TARGET_DIR}
# Update minor version (e.g. "1.2.3" => "1.2")
STORYBOOK_TARGET_DIR=gh-pages/${{ steps.prep.outputs.version_minor }}/storybook
STORYBOOK_TARGET_DIR=gh-pages/${{ env.version_minor }}/storybook
mkdir -p ${STORYBOOK_TARGET_DIR}
cp -R storybook-static/* ${STORYBOOK_TARGET_DIR}
DEMO_TARGET_DIR=gh-pages/${{ steps.prep.outputs.version_minor }}/demo
DEMO_TARGET_DIR=gh-pages/${{ env.version_minor }}/demo
mkdir -p ${DEMO_TARGET_DIR}
cp -R dist/sage-angular-demo/* ${DEMO_TARGET_DIR}
fi
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lock.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Lock Threads'
name: Lock threads

on:
schedule:
Expand Down

0 comments on commit 6125dfe

Please sign in to comment.