From 893354f92b125e6bd8913cea55271ebdfcac0cc1 Mon Sep 17 00:00:00 2001 From: Dan Essig Date: Tue, 3 Mar 2026 20:32:13 -0700 Subject: [PATCH] workflows --- .github/workflows/ci.yml | 75 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 41 +++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f9f6f7e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,75 @@ +name: CI + +on: + pull_request: + branches: [main] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + cache-dependency-path: | + package-lock.json + server/package-lock.json + client/package-lock.json + + - name: Install dependencies + run: npm ci && cd server && npm ci && cd ../client && npm ci + + - name: Lint server + run: npm run lint:server + + - name: Lint client + run: npm run lint:client + + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + cache-dependency-path: | + package-lock.json + server/package-lock.json + client/package-lock.json + + - name: Install dependencies + run: npm ci && cd server && npm ci && cd ../client && npm ci + + - name: Test server + run: npm run test:server + + - name: Test client + run: npm run test:client + + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + cache-dependency-path: | + package-lock.json + server/package-lock.json + client/package-lock.json + + - name: Install dependencies + run: npm ci && cd server && npm ci && cd ../client && npm ci + + - name: Build + run: npm run build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4084906 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release + +on: + push: + branches: [main] + +jobs: + release: + name: Tag and Release + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get version from package.json + id: version + run: echo "version=v$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT" + + - name: Check if tag exists + id: check_tag + run: | + if git rev-parse "refs/tags/${{ steps.version.outputs.version }}" >/dev/null 2>&1; then + echo "exists=true" >> "$GITHUB_OUTPUT" + else + echo "exists=false" >> "$GITHUB_OUTPUT" + fi + + - name: Create tag and release + if: steps.check_tag.outputs.exists == 'false' + env: + GH_TOKEN: ${{ github.token }} + run: | + git tag "${{ steps.version.outputs.version }}" + git push origin "${{ steps.version.outputs.version }}" + gh release create "${{ steps.version.outputs.version }}" \ + --title "${{ steps.version.outputs.version }}" \ + --generate-notes \ + --draft