From 4b7157c17ef9581d15bc04c0ae07fa1e16869262 Mon Sep 17 00:00:00 2001 From: Daniel Brooks Date: Thu, 30 Nov 2023 06:41:18 -0800 Subject: [PATCH] fix(ci): cleaning up github ci --- .github/workflows/publish.yml | 60 ++++++++++++++++++++-------------- .github/workflows/validate.yml | 14 ++++++++ package.json | 4 ++- 3 files changed, 52 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d97e323..2bd365b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,35 +1,45 @@ -name: Node.js Package - +name: Build + on: - pull_request: - branches: - - main - push: - branches: - - main - + push: + branches: ["main"] + pull_request: + branches: ["main"] jobs: - validator: + ## + # Runs semantic release in a regular + ## + release: + name: Semantic Release + timeout-minutes: 15 runs-on: ubuntu-latest + + # https://github.com/semantic-release/npm + permissions: + contents: write # to be able to publish a GitHub release + issues: write # to be able to comment on released issues + pull-requests: write # to be able to comment on released pull requests + id-token: write # to enable use of OIDC for npm provenance + steps: - - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - - uses: RoadieHQ/backstage-entity-validator@70da3dfb77cb4d0e150b9f6de953b806837d16df # tag=v0.3.2 + - name: Check out code + uses: actions/checkout@v4 with: - path: 'catalog-info.yaml' + fetch-depth: 2 - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - - uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # tag=v3.2.0 + - name: Setup Node.js environment + uses: actions/setup-node@v3 with: - node-version: '16.x' + node-version: 20 registry-url: 'https://registry.npmjs.org' - scope: '@pocket-tools' - - run: npm ci + - run: npm install -g npm + - name: Install dependencies + run: npm ci + - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies + run: npm audit signatures - name: Semantic Release - uses: cycjimmy/semantic-release-action@v2 + run: npm run release env: - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + NPM_CONFIG_PROVENANCE: true diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..b95ae0e --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,14 @@ +name: Build + +on: + pull_request: + branches: ["main"] + +jobs: + backstage_validator: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 + - uses: RoadieHQ/backstage-entity-validator@v0.3.11 + with: + path: 'catalog-info.yaml' \ No newline at end of file diff --git a/package.json b/package.json index 92fdbee..371b83c 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,9 @@ "bin/install.js" ], "scripts": { - "postinstall": "node bin/install.js" + "postinstall": "node bin/install.js", + "release": "semantic-release", + "release:check": "semantic-release --dryRun" }, "keywords": [ "tsconfig"