Add conditional dry-run #7
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: Create release and publish to NPM | |
on: | |
workflow_dispatch: | |
inputs: | |
dry-run: | |
description: "Dry run" | |
default: true | |
required: false | |
type: boolean | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
name: Build and deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Setup Node.js | |
uses: actions/setup-node@v4.0.1 | |
with: | |
node-version: 20.14.0 | |
- name: Install Dependencies | |
run: yarn install | |
- name: Lint | |
run: yarn run lint | |
- name: Build | |
run: yarn run build | |
- name: Configure NPM | |
env: | |
ARTIFACTORY_USERNAME: ${{ secrets.DEVEX_ARTIFACTORY_WRITER_USERNAME }} | |
ARTIFACTORY_PASSWORD: ${{ secrets.DEVEX_ARTIFACTORY_WRITER_TOKEN_BASE64_ENC }} | |
run: | | |
npm config set "@loomhq:registry" "https://packages.atlassian.com/api/npm/atlassian-npm/" | |
npm config set "//packages.atlassian.com/api/npm/atlassian-npm/:username" "${ARTIFACTORY_USERNAME}" | |
npm config set "//packages.atlassian.com/api/npm/atlassian-npm/:_password" "${ARTIFACTORY_PASSWORD}" | |
- name: Publish (dry-run) | |
if: inputs.dry-run | |
run: npm publish --dry-run | |
- name: Publish | |
if: ${{ ! inputs.dry-run }} | |
run: npm publish --dry-run |