From 75d48d246a22c405b9b846f499e662ea44e35692 Mon Sep 17 00:00:00 2001 From: Piotr Rogowski Date: Sun, 24 Sep 2023 10:57:36 +0200 Subject: [PATCH] Add Preview workflow that works with forks (#138) --- .github/workflows/build-preview.yml | 38 +++++++++++++++++++++++++++++ .github/workflows/build.yml | 23 ----------------- package.json | 2 +- 3 files changed, 39 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/build-preview.yml delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build-preview.yml b/.github/workflows/build-preview.yml new file mode 100644 index 0000000..fb462c8 --- /dev/null +++ b/.github/workflows/build-preview.yml @@ -0,0 +1,38 @@ +# Build preview to Cloudflare Pages +name: Build preview + +concurrency: + group: ${{ github.ref }}-preview + cancel-in-progress: true + +on: + pull_request: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + if: github.repository_owner == 'FOME-Tech' && github.actor != 'dependabot[bot]' + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + cache: "npm" + + - name: Install Node.js dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Save PR number + run: | + echo ${{ github.event.number }} > ./build/PR_NR + + - name: Upload preview build + uses: actions/upload-artifact@v2 + with: + name: build + path: build/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 50e008b..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Validate build to provide early feedback on pull requests -name: Build - -concurrency: - group: ${{ github.ref }}-build - cancel-in-progress: true - -on: - pull_request: - branches: [master] - -jobs: - validate: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 - with: - node-version-file: ".nvmrc" - cache: "npm" - - run: npm ci - - run: npm run build diff --git a/package.json b/package.json index 56a1df9..8f53d65 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "lint:fix:unsafe": "biome check . --apply-unsafe .", "lint:ts": "tsc", "lint:links": "node scripts/linkValidator.js 'docs/**/*.md?(x)'", - "lint:md": "npx markdownlint-cli docs", + "lint:md": "npx -y markdownlint-cli docs", "lint:biome": "biome check .", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy",