-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
mode: | ||
description: "Release mode" | ||
required: true | ||
default: "no publish" | ||
type: choice | ||
options: | ||
- "no publish" | ||
- "publish" | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: Get Package Version | ||
id: package-version | ||
uses: martinbeentjes/[email protected] | ||
|
||
- name: No Publish Build and Pack | ||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.mode == 'no publish' }} | ||
run: | | ||
npm run build | ||
npm pack | ||
- name: No Publish Artifact Upload | ||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.mode == 'no publish' }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: package-artifact | ||
path: prettier-plugin-embed-${{steps.package-version.outputs.current-version}}.tgz | ||
retention-days: 1 | ||
overwrite: true | ||
|
||
- name: Create Release Pull Request or Publish to npm | ||
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.mode == 'publish') }} | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
publish: npm publish | ||
commit: "chore(release): v${{steps.package-version.outputs.current-version}}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node |