Skip to content

Commit

Permalink
chore(ci): add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Sec-ant committed Jan 28, 2024
1 parent be9969d commit 671263b
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
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 }}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node

0 comments on commit 671263b

Please sign in to comment.