Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
edlu77 committed Feb 13, 2024
1 parent 1940731 commit 9cb7db9
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 117 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/build-previews.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
name: 'Netlify Preview Deploy'
name: Netlify Preview Deploy

on:
pull_request:
types: ['opened', 'edited', 'synchronize']

concurrency:
group: preview-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
deploy:
name: 'Deploy'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v4
fetch-depth: 0

- name: Prepare Deploy
uses: ./.github/actions/prepare-deploy
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: npm ci for website
run: npm ci
working-directory: website
- run: npm run build -- --output-hashing=none --base-href=/
working-directory: website
main-branch-name: develop
app-configuration: preview

- uses: jsmrcaga/action-netlify-deploy@master
- name: Publish
id: deploy
uses: netlify/actions/cli@master
with:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
args: deploy --dir=deploy --filter=ftu-ui
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
install_command: false
build_command: false
build_directory: website/dist/a2agc
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}

- name: Create Deploy Comment
uses: ./.github/actions/deploy-comment
with:
deploy-url: ${{steps.deploy.outputs.NETLIFY_URL}}
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CI

on:
push:
branches:
- main
- develop
pull_request:

concurrency:
group: ci-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
main:
name: Nx Cloud - Main Job
uses: nrwl/ci/.github/workflows/[email protected]
with:
number-of-agents: 3
init-commands: |
npx nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3
parallel-commands: |
npx nx-cloud record -- npx nx workspace-lint
npx nx-cloud record -- npx nx format:check
parallel-commands-on-agents: |
npx nx affected --target=lint --parallel=3
npx nx affected --target=test --parallel=3 --ci --code-coverage
npx nx affected --target=test-doc-coverage --parallel=3
npx nx affected --target=build --parallel=3
main-branch-name: develop

agents:
name: Nx Cloud - Agents
uses: nrwl/ci/.github/workflows/[email protected]
with:
number-of-agents: 3

slack-notification:
name: Slack Notification
if: ${{ always() }}
runs-on: ubuntu-latest
needs: main
steps:
- uses: kpritam/slack-job-status-action@v1
with:
job-status: ${{ needs.main.result }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
channel: github
36 changes: 14 additions & 22 deletions .github/workflows/production-build.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,33 @@
name: 'Production Build'
name: Staging Build

on:
workflow_run:
workflows: ['Tests']
workflows: ['CI']
branches: ['main']
types:
- completed

jobs:
deploy:
name: 'Deploy'
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v4
ref: main
fetch-depth: 0

- name: Prepare Deploy
uses: ./.github/actions/prepare-deploy
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: npm ci for website
run: npm ci
working-directory: website
- run: npm run build -- --output-hashing=none --base-href=/
working-directory: website
main-branch-name: main
app-configuration: production
nx-command: run-many

- uses: peaceiris/actions-gh-pages@v3
- name: Publish
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: website/dist/a2agc
commit_message: "Production deploy -- ${{ github.event.head_commit.message }}"
publish_dir: deploy
commit_message: 'Staging deploy -- ${{ github.event.head_commit.message }}'
36 changes: 14 additions & 22 deletions .github/workflows/staging-build.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,34 @@
name: 'Staging Build'
name: Staging Build

on:
workflow_run:
workflows: ['Tests']
workflows: ['CI']
branches: ['develop']
types:
- completed

jobs:
deploy:
name: 'Deploy'
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v4
ref: develop
fetch-depth: 0

- name: Prepare Deploy
uses: ./.github/actions/prepare-deploy
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: npm ci for website
run: npm ci
working-directory: website
- run: npm run build -- --output-hashing=none --base-href=/
working-directory: website
main-branch-name: develop
app-configuration: staging
nx-command: run-many

- uses: peaceiris/actions-gh-pages@v3
- name: Publish
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: website/dist/a2agc
publish_dir: deploy
publish_branch: staging
commit_message: "Staging deploy -- ${{ github.event.head_commit.message }}"
commit_message: 'Staging deploy -- ${{ github.event.head_commit.message }}'
51 changes: 0 additions & 51 deletions .github/workflows/tests.yml

This file was deleted.

0 comments on commit 9cb7db9

Please sign in to comment.