2023-07-22 17:27:41 -07:00
|
|
|
name: Build and Test
|
2021-07-18 11:54:00 -04:00
|
|
|
|
|
|
|
on:
|
2023-08-24 12:31:15 -07:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- v4
|
2021-07-18 11:54:00 -04:00
|
|
|
push:
|
|
|
|
branches:
|
2023-08-20 14:34:00 -07:00
|
|
|
- v4
|
2024-07-01 13:58:34 +10:00
|
|
|
workflow_dispatch:
|
2021-07-18 11:54:00 -04:00
|
|
|
|
|
|
|
jobs:
|
2023-07-19 22:00:44 -07:00
|
|
|
build-and-test:
|
2023-08-06 19:52:30 -07:00
|
|
|
if: ${{ github.repository == 'jackyzha0/quartz' }}
|
2023-08-02 20:56:31 -07:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [windows-latest, macos-latest, ubuntu-latest]
|
|
|
|
runs-on: ${{ matrix.os }}
|
2023-05-28 17:44:08 -07:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2021-07-18 11:54:00 -04:00
|
|
|
steps:
|
2024-07-01 00:05:42 -04:00
|
|
|
- uses: actions/checkout@v4
|
2022-05-03 01:51:15 -04:00
|
|
|
with:
|
2023-05-28 17:44:08 -07:00
|
|
|
fetch-depth: 0
|
2021-07-18 11:54:00 -04:00
|
|
|
|
2023-05-28 17:44:08 -07:00
|
|
|
- name: Setup Node
|
2024-07-01 00:05:42 -04:00
|
|
|
uses: actions/setup-node@v4
|
2021-07-18 11:54:00 -04:00
|
|
|
with:
|
2023-06-07 10:52:53 -07:00
|
|
|
node-version: 18
|
2021-07-18 11:54:00 -04:00
|
|
|
|
2023-05-28 17:44:08 -07:00
|
|
|
- name: Cache dependencies
|
2024-07-01 00:05:42 -04:00
|
|
|
uses: actions/cache@v4
|
2021-07-18 11:54:00 -04:00
|
|
|
with:
|
2023-05-28 17:44:08 -07:00
|
|
|
path: ~/.npm
|
|
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-node-
|
2021-07-18 11:54:00 -04:00
|
|
|
|
2023-05-28 17:44:08 -07:00
|
|
|
- run: npm ci
|
2023-07-22 17:42:13 -07:00
|
|
|
|
2023-07-22 17:39:10 -07:00
|
|
|
- name: Check types and style
|
2023-07-22 17:42:13 -07:00
|
|
|
run: npm run check
|
2023-05-28 17:44:08 -07:00
|
|
|
|
2023-07-13 00:19:35 -07:00
|
|
|
- name: Test
|
|
|
|
run: npm test
|
2021-07-18 11:54:00 -04:00
|
|
|
|
2023-09-10 23:07:17 -07:00
|
|
|
- name: Ensure Quartz builds, check bundle info
|
|
|
|
run: npx quartz build --bundleInfo
|
2023-11-01 10:03:45 -07:00
|
|
|
|
2024-02-23 19:04:38 -08:00
|
|
|
publish-tag:
|
2024-06-17 21:45:58 -07:00
|
|
|
if: ${{ github.repository == 'jackyzha0/quartz' && github.ref == 'refs/heads/v4' }}
|
2024-02-23 19:05:26 -08:00
|
|
|
runs-on: ubuntu-latest
|
2024-02-23 19:04:38 -08:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
steps:
|
2024-07-01 00:05:42 -04:00
|
|
|
- uses: actions/checkout@v4
|
2024-02-23 19:08:39 -08:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Node
|
2024-07-01 00:05:42 -04:00
|
|
|
uses: actions/setup-node@v4
|
2024-02-23 19:08:39 -08:00
|
|
|
with:
|
|
|
|
node-version: 18
|
2024-02-23 19:00:47 -08:00
|
|
|
- name: Get package version
|
|
|
|
run: node -p -e '`PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV
|
2023-11-01 10:03:45 -07:00
|
|
|
- name: Create release tag
|
2024-07-01 00:05:42 -04:00
|
|
|
uses: pkgdeps/git-tag-action@v3
|
2023-11-01 10:03:45 -07:00
|
|
|
with:
|
2024-02-23 19:00:47 -08:00
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
github_repo: ${{ github.repository }}
|
|
|
|
version: ${{ env.PACKAGE_VERSION }}
|
|
|
|
git_commit_sha: ${{ github.sha }}
|
|
|
|
git_tag_prefix: "v"
|