Release #113
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: Release | ||
on: | ||
schedule: | ||
- cron: '0 12 * * 0' | ||
workflow_dispatch: | ||
inputs: | ||
release-type: | ||
description: 'Release Type' | ||
required: true | ||
default: 'patch' | ||
type: choice | ||
options: | ||
- major | ||
- minor | ||
- patch | ||
- premajor | ||
- preminor | ||
- prepatch | ||
- prerelease | ||
prerelease: | ||
description: 'Prerelease' | ||
required: true | ||
default: false | ||
type: boolean | ||
skip-if-no-diff: | ||
description: 'Skip if no diff' | ||
required: true | ||
default: false | ||
type: boolean | ||
diff-targets: | ||
description: 'Diff Targets' | ||
required: false | ||
default: 'dist/**/*' | ||
type: string | ||
dry-run: | ||
description: 'Dry run' | ||
required: true | ||
default: false | ||
type: boolean | ||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yml | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
test: | ||
uses: ./.github/workflows/test.yml | ||
Check failure on line 50 in .github/workflows/release.yml GitHub Actions / .github/workflows/release.ymlInvalid workflow file
|
||
permissions: write-all | ||
secrets: inherit | ||
eslint: | ||
uses: ./.github/workflows/eslint.yml | ||
codeql: | ||
uses: ./.github/workflows/codeql.yml | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
release: | ||
name: Release | ||
needs: [build, test, eslint, codeql] | ||
concurrency: release | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag: ${{ steps.release.outputs.tag }} | ||
skipped: ${{ steps.release.outputs.skipped }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: 'main' | ||
fetch-depth: 0 | ||
- id: release | ||
uses: CatChen/node-package-release-action@v2 | ||
with: | ||
release-type: ${{ inputs.release-type || 'patch' }} | ||
prerelease: ${{ inputs.prerelease || false }} | ||
update-shorthand-release: true | ||
dry-run: ${{ inputs.dry-run || false }} | ||
skip-if-no-diff: ${{ inputs.skip-if-no-diff || true }} | ||
diff-targets: ${{ inputs.diff-targets || 'dist/**/*' }} | ||
publish: | ||
name: Publish | ||
needs: [release] | ||
if: ${{ needs.release.outputs.skipped != 'true' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
if: ${{ !inputs.dry-run }} | ||
with: | ||
ref: ${{ needs.release.outputs.tag }} | ||
- uses: actions/checkout@v4 | ||
if: ${{ inputs.dry-run }} | ||
with: | ||
ref: ${{ github.ref_name || github.ref }} | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
check-latest: true | ||
registry-url: https://registry.npmjs.org/ | ||
cache: yarn | ||
- env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
DRY_RUN: ${{ inputs.dry-run || false }} | ||
run: | | ||
yarn install | ||
yarn build | ||
npm whoami | ||
npm config ls -l | ||
if [[ "$DRY_RUN" = true ]] | ||
then | ||
npm publish --dry-run | ||
else | ||
npm publish | ||
fi |