2.0.0-rev #32
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release to production | |
on: | |
release: | |
types: [released] | |
workflow_dispatch: | |
inputs: | |
app: | |
default: "console" | |
description: "App to build" | |
required: true | |
concurrency: | |
group: prod-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
prep: | |
runs-on: ubuntu-latest | |
outputs: | |
lint_args: ${{ steps.prep.outputs.lint_args }} | |
test_args: ${{ steps.prep.outputs.test_args }} | |
build_args: ${{ steps.prep.outputs.build_args }} | |
e2e_args: ${{ steps.prep.outputs.e2e_args }} | |
deploy_args: ${{ steps.prep.outputs.deploy_args }} | |
steps: | |
- name: Set argument variables | |
id: prep | |
run: | | |
if [[ "${{github.event_name}}" == "release" ]]; then | |
echo ::set-output name=lint_args::"--parallel=3" | |
echo ::set-output name=test_args::"--parallel=3 --ci --code-coverage" | |
echo ::set-output name=build_args::"--parallel=3" | |
echo ::set-output name=e2e_args::"--parallel=3 --ci" | |
echo ::set-output name=deploy_args::"" | |
else | |
echo ::set-output name=lint_args::"--parallel=3 --files apps/${{ github.event.inputs.app }}/project.json" | |
echo ::set-output name=test_args::"--parallel=3 --files apps/${{ github.event.inputs.app }}/project.json --ci --code-coverage" | |
echo ::set-output name=build_args::"--parallel=3 --files apps/${{ github.event.inputs.app }}/project.json" | |
echo ::set-output name=e2e_args::"--parallel=3 --files apps/${{ github.event.inputs.app }}/project.json --ci" | |
echo ::set-output name=deploy_args::"--files apps/${{ github.event.inputs.app }}/project.json" | |
fi | |
main: | |
name: Nx Cloud - Main Job | |
needs: [prep] | |
uses: nrwl/ci/.github/workflows/[email protected] | |
with: | |
number-of-agents: 3 | |
main-branch-name: trunk | |
environment-variables: | | |
LINT_ARGS=${{ needs.prep.outputs.lint_args }} | |
TEST_ARGS=${{ needs.prep.outputs.test_args }} | |
BUILD_ARGS=${{ needs.prep.outputs.build_args }} | |
E2E_ARGS=${{ needs.prep.outputs.e2e_args }} | |
init-commands: | | |
npx nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3 | |
npx nx-cloud record -- npx nx format:write | |
parallel-commands-on-agents: | | |
npx nx affected --target=lint ${LINT_ARGS} | |
npx nx affected --target=test ${TEST_ARGS} | |
npx nx affected --target=build ${BUILD_ARGS} | |
npx nx affected --target=e2e ${E2E_ARGS} | |
artifacts-path: dist/apps | |
artifacts-name: affected-apps | |
agents: | |
name: Nx Cloud - Agents | |
uses: nrwl/ci/.github/workflows/[email protected] | |
with: | |
number-of-agents: 3 | |
deploy: | |
strategy: | |
matrix: | |
client: [ic, me] | |
name: Deploy affected applications | |
needs: [prep, main, agents] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET }} | |
aws-region: us-east-1 | |
if: matrix.client == 'ic' | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.ME_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.ME_AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
if: matrix.client == 'me' | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v3 | |
with: | |
main-branch-name: 'trunk' | |
- name: Download artifact | |
id: download-artifact | |
uses: actions/download-artifact@v3 | |
continue-on-error: true | |
with: | |
name: affected-apps | |
path: dist/apps | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Replace favicons | |
run: npx nx affected --target=replace-favicon | |
env: | |
TENANT: ${{ matrix.client }} | |
- name: run many deployments | |
run: npx nx affected --target=deploy:prod ${DEPLOY_ARGS} | |
env: | |
CONSOLE_BUCKET_PROD: ${{ secrets.CONSOLE_BUCKET_PROD }} | |
CONSOLE_DISTRIBUTION_ID_PROD: ${{ secrets.CONSOLE_DISTRIBUTION_ID_PROD }} | |
DEPLOY_ARGS: ${{ needs.prep.outputs.deploy_args }} |