Skip to content

Commit

Permalink
ci: workflow: tag -> release -> publish
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Jul 10, 2022
1 parent 109d80f commit 6c8febc
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 31 deletions.
35 changes: 6 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,18 @@ name: Release

on:
push:
branches:
- master
tags:
- v*.*.*

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
- name: Checkout
uses: actions/checkout@v3
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Setup Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
cache: pnpm

- name: Install Dependencies
run: pnpm i

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
- name: Release
uses: softprops/action-gh-release@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
commit: 'chore: release vscode-mdx'
title: 'chore: release vscode-mdx'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
body_path: ${{ github.workspace }}/CHANGELOG.md
44 changes: 44 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
push:
branches:
- master

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Setup Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
cache: pnpm

- name: Install Dependencies
run: pnpm i

- name: Create Release Pull Request
id: changesets
uses: changesets/action@v1
with:
commit: 'chore: release vscode-mdx'
title: 'chore: release vscode-mdx'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Push tags
if: steps.changesets.outputs.hasChangesets == 'false'
run: git push --follow-tags
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@
],
"scripts": {
"lint": "eslint . --cache -f friendly",
"prepare": "patch-package && simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
"release": "changeset publish"
"prepare": "patch-package && simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0"
},
"devDependencies": {
"@1stg/common-config": "^6.0.0",
Expand Down

0 comments on commit 6c8febc

Please sign in to comment.