Keystatic implementation for Jobs/Freelancers #134
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: CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
merge_group: | |
pull_request: | |
paths-ignore: | |
- ".vscode/**" | |
- "**/*.md" | |
- ".github/ISSUE_TEMPLATE/**" | |
# Automatically cancel older in-progress jobs on the same branch | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
env: | |
FORCE_COLOR: true | |
ASTRO_TELEMETRY_DISABLED: true | |
# 7 GiB by default on GitHub, setting to 6 GiB | |
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | |
NODE_OPTIONS: --max-old-space-size=6144 | |
BUILD_PATH: "." # default value when not using subfolders | |
# BUILD_PATH: subfolder | |
jobs: | |
check: | |
name: astro check | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Detect package manager | |
id: detect-package-manager | |
run: | | |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then | |
echo "manager=yarn" >> $GITHUB_OUTPUT | |
echo "command=install" >> $GITHUB_OUTPUT | |
echo "runner=yarn" >> $GITHUB_OUTPUT | |
echo "lockfile=yarn.lock" >> $GITHUB_OUTPUT | |
exit 0 | |
elif [ -f "${{ github.workspace }}/package.json" ]; then | |
echo "manager=npm" >> $GITHUB_OUTPUT | |
echo "command=ci" >> $GITHUB_OUTPUT | |
echo "runner=npx --no-install" >> $GITHUB_OUTPUT | |
echo "lockfile=package-lock.json" >> $GITHUB_OUTPUT | |
exit 0 | |
else | |
echo "Unable to determine package manager" | |
exit 1 | |
fi | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: ${{ steps.detect-package-manager.outputs.manager }} | |
cache-dependency-path: ${{ env.BUILD_PATH }}/${{ steps.detect-package-manager.outputs.lockfile }} | |
- name: Install dependencies | |
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} | |
working-directory: ${{ env.BUILD_PATH }} | |
- name: Status | |
run: git status | |
- name: Astro Info | |
run: | | |
${{ steps.detect-package-manager.outputs.runner }} astro info | |
- name: Astro Check | |
run: | | |
${{ steps.detect-package-manager.outputs.runner }} astro check \ | |
--minimumFailingSeverity error \ | |
--minimumSeverity warning |