Skip to content

Commit

Permalink
fixup! fixup! ci: dissect workflows in order to enable pr website deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Hotell committed Oct 25, 2024
1 parent e544842 commit 531356c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 57 deletions.
45 changes: 7 additions & 38 deletions .github/workflows/bundle-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ concurrency:
cancel-in-progress: true

env:
env:
NX_PARALLEL: 6 # ubuntu-latest = 4-core CPU / 16 GB of RAM | macos-14-xlarge (arm) = 6-core CPU / 14 GB of RAM
NX_PREFER_TS_NODE: true
NX_VERBOSE_LOGGING: true
Expand All @@ -21,24 +22,20 @@ env:
# DEPLOY_BASE_PATH: ''
DEPLOY_HOST: fluentuipr.z22.web.core.windows.net
DEPLOY_URL: https://fluentuipr.z22.web.core.windows.net/${{ github.event.pull_request.number || github.ref_name }}
# DEPLOYHOST: fluentuipr.z22.web.core.windows.net
# DEPLOYURL: https://${{ env.DEPLOYHOST }}/
DEPLOY_BASE_PATH: pull/${{github.event.pull_request.number}}

IS_PR: ${{ github.event_name == 'pull_request' }}
TARGET_BRANCH: ${{ github.event.pull_request.base.ref || '' }}
# DEPLOY_BASE_PATH: ${{ github.event.pull_request.number ? 'pull/' + github.event.pull_request.number : 'heads/' + github.ref_name }}

# GitHub Secrets for Azure access
# This service principal ("subscription" is a misleading name) only has access to the fluentuipr storage account
AZURE_SUBSCRIPTION: Azure PR deploy - NEW
AZURE_STORAGE: fluentuipr

IS_PR: ${{ github.event_name == 'pull_request' }}
TARGET_BRANCH: ${{ github.event.pull_request.base.ref || '' }}
DEPLOY_BASE_PATH: pull/${{github.event.pull_request.number}}
# DEPLOY_BASE_PATH: ${{ github.event.pull_request.number ? 'pull/' + github.event.pull_request.number : 'heads/' + github.ref_name }}
# SKIP_COMPONENT_GOVERNANCE_DETECTION: true

jobs:
bundle-size:
runs-on: ubuntu-latest
# runs-on: macos-14-xlarge
runs-on: macos-14-xlarge
permissions:
contents: 'read'
actions: 'read'
Expand Down Expand Up @@ -82,34 +79,6 @@ jobs:
monosize-report.md
pr.txt
# - name: Read the monosize report
# id: read_report
# if: ${{ github.event_name == 'pull_request' }}
# run: |
# if [ -f monosize-report.md ]; then
# report=$(cat monosize-report.md)
# echo "report<<EOF" >> $GITHUB_ENV
# echo "$report" >> $GITHUB_ENV
# echo "EOF" >> $GITHUB_ENV
# else
# echo "No report found"
# fi

# - name: Post results to PR (PR only)
# if: github.event_name == 'pull_request'
# uses: actions/github-script@v7
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }} # Use a GitHub token (this is automatically provided)
# script: |
# const run = require('./.github/bundle-size-comment');
# await run({github,context,core});

# - name: Post results to PR (PR only)
# if: github.event_name == 'pull_request'
# uses: marocchino/sticky-pull-request-comment@v2
# with:
# path: monosize-report.md

- name: Build all packages & create reports (non-PR)
if: github.event_name != 'pull_request'
run: yarn nx run-many -t bundle-size --nxBail
Expand Down
39 changes: 28 additions & 11 deletions .github/workflows/pr-website-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,19 @@ env:
# DEPLOY_BASE_PATH: ''
DEPLOY_HOST: fluentuipr.z22.web.core.windows.net
DEPLOY_URL: https://fluentuipr.z22.web.core.windows.net/${{ github.event.pull_request.number || github.ref_name }}
# DEPLOYHOST: fluentuipr.z22.web.core.windows.net
# DEPLOYURL: https://${{ env.DEPLOYHOST }}/
DEPLOY_BASE_PATH: pull/${{github.event.pull_request.number}}

IS_PR: ${{ github.event_name == 'pull_request' }}
TARGET_BRANCH: ${{ github.event.pull_request.base.ref || '' }}
# DEPLOY_BASE_PATH: ${{ github.event.pull_request.number ? 'pull/' + github.event.pull_request.number : 'heads/' + github.ref_name }}

# GitHub Secrets for Azure access
# This service principal ("subscription" is a misleading name) only has access to the fluentuipr storage account
AZURE_SUBSCRIPTION: Azure PR deploy - NEW
AZURE_STORAGE: fluentuipr

IS_PR: ${{ github.event_name == 'pull_request' }}
TARGET_BRANCH: ${{ github.event.pull_request.base.ref || '' }}
DEPLOY_BASE_PATH: pull/${{github.event.pull_request.number}}
# DEPLOY_BASE_PATH: ${{ github.event.pull_request.number ? 'pull/' + github.event.pull_request.number : 'heads/' + github.ref_name }}
# SKIP_COMPONENT_GOVERNANCE_DETECTION: true

jobs:
bundle-and-deploy:
bundle:
runs-on: macos-14-xlarge
permissions:
contents: 'read'
Expand Down Expand Up @@ -70,7 +67,27 @@ jobs:
if: github.event_name == 'pull_request'
run: yarn nx run pr-deploy-site:generate:site

- name: Upload PR deploy site
- name: Upload WebSite artifacts
uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'pull_request' }}
with:
name: pr-website-artifacts
if-no-files-found: error
path: |
apps/pr-deploy-site/dist/
deploy:
runs-on: ubuntu-latest
needs: ['bundle']
steps:
- name: Download WebSite artifacts
uses: dawidd6/action-download-artifact@v2
with:
name: pr-website-artifacts
path: ./apps/pr-deploy-site/dist/
workflow_conclusion: success

- name: Upload PR WebSite
continue-on-error: true
if: github.event_name == 'pull_request'
uses: azure/cli@v2
Expand All @@ -85,7 +102,7 @@ jobs:
--auth-mode login \
--overwrite
- name: Save DEPLOY url
- name: Save WebSite DEPLOY url
run: echo ${{env.DEPLOY_HOST}}/${{ env.DEPLOY_BASE_PATH }} > website-deploy-url.txt

- name: Save PR number
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,17 @@ env:
# DEPLOY_BASE_PATH: ''
DEPLOY_HOST: fluentuipr.z22.web.core.windows.net
DEPLOY_URL: https://fluentuipr.z22.web.core.windows.net/${{ github.event.pull_request.number || github.ref_name }}
# DEPLOYHOST: fluentuipr.z22.web.core.windows.net
# DEPLOYURL: https://${{ env.DEPLOYHOST }}/
DEPLOY_BASE_PATH: pull/${{github.event.pull_request.number}}

IS_PR: ${{ github.event_name == 'pull_request' }}
TARGET_BRANCH: ${{ github.event.pull_request.base.ref || '' }}
# DEPLOY_BASE_PATH: ${{ github.event.pull_request.number ? 'pull/' + github.event.pull_request.number : 'heads/' + github.ref_name }}

# GitHub Secrets for Azure access
# This service principal ("subscription" is a misleading name) only has access to the fluentuipr storage account
AZURE_SUBSCRIPTION: Azure PR deploy - NEW
AZURE_STORAGE: fluentuipr

IS_PR: ${{ github.event_name == 'pull_request' }}
TARGET_BRANCH: ${{ github.event.pull_request.base.ref || '' }}
DEPLOY_BASE_PATH: pull/${{github.event.pull_request.number}}
# DEPLOY_BASE_PATH: ${{ github.event.pull_request.number ? 'pull/' + github.event.pull_request.number : 'heads/' + github.ref_name }}
# SKIP_COMPONENT_GOVERNANCE_DETECTION: true

jobs:
main:
runs-on: macos-14-xlarge
Expand Down

0 comments on commit 531356c

Please sign in to comment.