From 10e3a96564ccc5ea857fbb60c6e7abef43bea944 Mon Sep 17 00:00:00 2001 From: "Jack Boswell (boswelja)" Date: Tue, 30 Apr 2024 09:04:27 +0000 Subject: [PATCH 1/2] Create pr-ci and update release workflows --- .github/workflows/pr-ci.yml | 39 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 6 +++--- 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pr-ci.yml diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml new file mode 100644 index 0000000..462c481 --- /dev/null +++ b/.github/workflows/pr-ci.yml @@ -0,0 +1,39 @@ +name: PR Validation + +on: + # Triggers the workflow on push or pull request events but only for the "master" branch + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + # Set up NPM and deps + - name: Set up NPM + run: npm ci + + # Do a build + - name: Run Build + run: npm run build + + # Check whether the compiled library changed + - name: Check Build Updated + uses: tj-actions/verify-changed-files@v19 + id: verify-built-lib + with: + files: lib/index.js + + # If it did change, the authro forgot to build. Fail the action + - name: Verify Build Updated + if: steps.verify-changed-files.outputs.files_changed == 'true' + run: exit 1 + + - name: Run Tests + run: npm test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a13fe11..bb54e36 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,17 +12,17 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} # checkout the correct branch name fetch-depth: 0 # fetch the whole repo history - name: Git Version - uses: codacy/git-version@2.5.0 + uses: codacy/git-version@2.8.0 id: version with: release-branch: main - name: Create Release - uses: ncipollo/release-action@v1.8.6 + uses: ncipollo/release-action@v1.14.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From daffe662978fffe677709611c61590f782b77196 Mon Sep 17 00:00:00 2001 From: Jack Boswell Date: Tue, 30 Apr 2024 21:09:03 +1200 Subject: [PATCH 2/2] Fix PR CI workflow (#100) --- .github/workflows/pr-ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 462c481..3540662 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -28,12 +28,9 @@ jobs: uses: tj-actions/verify-changed-files@v19 id: verify-built-lib with: - files: lib/index.js + files: dist/index.js # If it did change, the authro forgot to build. Fail the action - name: Verify Build Updated if: steps.verify-changed-files.outputs.files_changed == 'true' run: exit 1 - - - name: Run Tests - run: npm test