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