CI by @jaswrks #729
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
## | |
# GitHub CI workflow. | |
# | |
# GitHub is aware of this config file's location. | |
# | |
# @note CUSTOM EDITS ONLY PLEASE! | |
# @note In the future this file will be updated automatically. | |
# @note Only `<custom:start.../custom:end>` will be preserved below. | |
## | |
name: 'CI' # <https://o5p.me/QsaIUU> | |
run-name: 'CI by @${{github.actor}}' | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- 'main' | |
workflow_dispatch: | |
concurrency: | |
cancel-in-progress: true | |
group: ${{github.workflow}}-${{github.ref}} | |
jobs: | |
deployment: | |
if: github.repository_owner == 'clevercanyon' | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node-version: [20.9.0] | |
runs-on: ${{matrix.os}} | |
environment: ci # CI environment. | |
permissions: # GitHub token permissions. | |
contents: read # Mininum requirements. | |
env: # Supplied by permissions above. | |
USER_GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
# Supplied by org-wide action secrets. | |
USER_NPM_TOKEN: ${{secrets.USER_NPM_TOKEN}} | |
# Supplied by repo environment secrets. | |
# Only available for repos using a Dotenv Vault. | |
USER_DOTENV_KEY_MAIN: ${{secrets.USER_DOTENV_KEY_MAIN || ''}} | |
USER_DOTENV_KEY_CI: ${{secrets.USER_DOTENV_KEY_CI || ''}} | |
steps: | |
- name: Checkout Project Repo | |
uses: actions/checkout@v4 | |
- name: Setup Node v${{matrix.node-version}} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node-version}} | |
cache: npm # Caches NPM dependencies. | |
- name: Parse Project Package JSON | |
shell: bash | |
run: | | |
echo 'PKG_JSON='"$(jq -c . ./package.json)" >> $GITHUB_ENV; | |
echo 'PKG_JSON_C10N='"$(jq -c '.config | .c10n | .["&"]' ./package.json)" >> $GITHUB_ENV; | |
- name: Install Madrun Dependency | |
shell: bash | |
run: | | |
npm install -g @clevercanyon/madrun; | |
- name: Install Project | |
shell: bash | |
run: | | |
madrun install project --mode=ci; | |
- name: Run Project Tests | |
if: fromJson(env.PKG_JSON_C10N).build.appType | |
shell: bash | |
run: | | |
madrun tests --mode=ci; | |
## | |
# Customizations | |
# <custom:start> | |
# </custom:end> |