From 9b45923765f4a1abcc2b26801d6baf0b8fcdbb6d Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Fri, 7 Feb 2025 16:33:11 +0100 Subject: [PATCH] ci(workflow): added workflow for pr --- .github/workflows/main.yml | 10 ++--- .github/workflows/next.yml | 4 +- .github/workflows/pull-request.yml | 67 ++++++++++++++++++++++++++++++ .github/workflows/test.yml | 2 +- 4 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aa49c22..75dc92a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [20] + node: [22] steps: - uses: actions/setup-node@v4 @@ -52,7 +52,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [20] + node: [22] steps: - uses: actions/setup-node@v4 @@ -82,7 +82,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [20] + node: [22] steps: - uses: actions/setup-node@v4 @@ -117,7 +117,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [20] + node: [22] steps: - uses: actions/setup-node@v4 @@ -152,7 +152,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [20] + node: [22] steps: - name: Download Artifact (Docs) uses: actions/download-artifact@v4 diff --git a/.github/workflows/next.yml b/.github/workflows/next.yml index aa0990a..693b8f9 100644 --- a/.github/workflows/next.yml +++ b/.github/workflows/next.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [20] + node: [22] steps: - uses: actions/setup-node@v4 @@ -52,7 +52,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [20] + node: [22] steps: - uses: actions/setup-node@v4 diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..fa0693e --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,67 @@ +name: Pull-Request + +on: + pull_request: + branches: + - "**" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + install: + name: Install + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node: [22] + + steps: + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + - name: Checkout Repo + uses: actions/checkout@v4 + - name: cache node_modules + uses: actions/cache@v4 + id: cache + with: + path: | + node_modules + key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }} + + - name: Install Dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: npm ci + + - name: Lint + run: npm run lint + + publish: + name: Publish Preview + needs: install + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node: [22] + + steps: + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + - name: Checkout Repo + uses: actions/checkout@v4 + - name: cache node_modules + uses: actions/cache@v4 + id: cache + with: + path: node_modules + key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }} + - name: Build + run: | + npx pkg-pr-new publish diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 234f54a..943637f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: matrix: os: [ubuntu-latest] #os: [ubuntu-latest, macos-latest, windows-latest] - node: [20] + node: [22] steps: - uses: actions/setup-node@v4