mirror of
https://github.com/actions/attest-build-provenance.git
synced 2026-06-13 18:19:53 +00:00
Update check-dist.yml
This commit is contained in:
parent
08528b0d2d
commit
1ff46e0aea
90
.github/workflows/check-dist.yml
vendored
90
.github/workflows/check-dist.yml
vendored
@ -1,66 +1,24 @@
|
|||||||
# In TypeScript actions, `dist/` is a special directory. When you reference
|
- name: Setup Node.js environment
|
||||||
# an action with the `uses:` property, `dist/index.js` is the code that will be
|
uses: actions/setup-node@v4.0.2
|
||||||
# run. For this project, the `dist/index.js` file is transpiled from other
|
with:
|
||||||
# source files. This workflow ensures the `dist/` directory contains the
|
# Set always-auth in npmrc.
|
||||||
# expected transpiled code.
|
always-auth: # optional, default is false
|
||||||
#
|
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.
|
||||||
# If this workflow is run from a feature branch, it will act as an additional CI
|
node-version: # optional
|
||||||
# check and fail if the checked-in `dist/` directory does not match what is
|
# File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions.
|
||||||
# expected from the build.
|
node-version-file: # optional
|
||||||
name: Check Transpiled JavaScript
|
# Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.
|
||||||
|
architecture: # optional
|
||||||
on:
|
# Set this option if you want the action to check for the latest available version that satisfies the version spec.
|
||||||
pull_request:
|
check-latest: # optional
|
||||||
branches:
|
# Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.
|
||||||
- main
|
registry-url: # optional
|
||||||
push:
|
# Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/).
|
||||||
branches:
|
scope: # optional
|
||||||
- main
|
# Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
|
||||||
|
token: # optional, default is ${{ github.server_url == 'https://github.com' && github.token || '' }}
|
||||||
permissions:
|
# Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.
|
||||||
contents: read
|
cache: # optional
|
||||||
|
# Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.
|
||||||
jobs:
|
cache-dependency-path: # optional
|
||||||
check-dist:
|
|
||||||
name: Check dist/
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
id: checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
id: setup-node
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version-file: .node-version
|
|
||||||
cache: npm
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
id: install
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Build dist/ Directory
|
|
||||||
id: build
|
|
||||||
run: npm run bundle
|
|
||||||
|
|
||||||
# This will fail the workflow if the PR wasn't created by Dependabot.
|
|
||||||
- name: Compare Directories
|
|
||||||
id: diff
|
|
||||||
run: |
|
|
||||||
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
|
|
||||||
echo "Detected uncommitted changes after build. See status below:"
|
|
||||||
git diff --ignore-space-at-eol --text dist/
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If `dist/` was different than expected, and this was not a Dependabot
|
|
||||||
# PR, upload the expected version as a workflow artifact.
|
|
||||||
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
|
|
||||||
name: Upload Artifact
|
|
||||||
id: upload
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: dist/
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user