ci: generates provenance statement on publish. #208
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
- push | |
- pull_request | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install Imposter | |
uses: imposter-project/imposter-github-action/setup@v0.6.1 | |
- name: Pull engine | |
run: | | |
imposter engine pull --version 4.5.8 | |
imposter engine pull --version latest | |
- name: Install core module dependencies | |
run: npm install | |
- name: Test core module | |
run: | | |
export IMPOSTER_DOCKER_CONTAINERUSER="$(id -u)" | |
npm test | |
- name: Build core module | |
run: npm run build | |
- name: Install sample project dependencies | |
run: | | |
npm run prep-sample | |
npm install | |
working-directory: sample | |
- name: Test sample project | |
working-directory: sample | |
run: | | |
export IMPOSTER_DOCKER_CONTAINERUSER="$(id -u)" | |
npm test | |
release: | |
needs: build | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
# This is required for the `npm publish` command to generate provenance | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Get Changelog Entries | |
uses: release-tools/since@707ab359a9d7f14e5d19126ec19e3fe218b8cbcc | |
with: | |
output-file: version_changelog.txt | |
- name: Publish to NPM | |
run: npm publish --provenance --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }} | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: version_changelog.txt | |
draft: false | |
prerelease: false |