Skip to content

Commit

Permalink
Add release ci (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarrencev authored May 16, 2024
1 parent 166b300 commit b55d15a
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: release-dispatch
on:
workflow_dispatch:
inputs:
version:
description: Version to release
required: true
type: string

jobs:
propose-release:
permissions:
pull-requests: write
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure Git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org/"

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: "8"
- name: Update Workspace Packages Version
run: |
VERSION=${{ github.event.inputs.version }}
pnpm -r exec -- bash -c "npm version $VERSION --no-git-tag-version"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.CREATE_PR_TOKEN }}
title: "Prepare release: ${{ github.event.inputs.version }}"
commit-message: "Prepare release: ${{ github.event.inputs.version }}"
branch: "prepare-release-${{ github.event.inputs.version }}"
base: main
delete-branch: true
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish to npm

on:
workflow_dispatch:
pull_request:
types: [closed]
branches:
- main

jobs:
publish:
if:
(github.event.pull_request.merged == true &&
github.event.pull_request.head.ref == 'prepare-release') ||
github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org/"

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: "8"

- name: Install dependencies
run: pnpm install

- name: Publish to npm
run: pnpm release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit b55d15a

Please sign in to comment.