Skip to content

Commit

Permalink
chore: add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
zcf0508 committed Aug 24, 2023
1 parent 8b68c59 commit 4fc0231
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 1 deletion.
81 changes: 81 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CI

on:
push:
branches:
- master

pull_request:
branches:
- master

merge_group: {}

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Set node
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm

- name: Setup
run: npm i -g pnpm@8

- name: Install
run: pnpm i

test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node_version: [16, 18]
include:
- os: macos-latest
node_version: 18
- os: windows-latest
node_version: 18
fail-fast: false

steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Set node ${{ matrix.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
cache: pnpm

- run: corepack enable

- name: Setup
run: npm i -g pnpm@8

- name: Install
run: pnpm i

- name: Build
run: pnpm run build

- name: Test
run: pnpm run test

- name: Typecheck
run: pnpm run typecheck
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
release:
permissions:
id-token: write
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Set node
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm
registry-url: 'https://registry.npmjs.org'

- run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Install Dependencies
run: pnpm i

- name: PNPM build
run: pnpm run build

- name: Publish to NPM
run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true

- name: Publish to VSCE
run: npm run publish
working-directory: ./vscode
env:
VSCE_TOKEN: ${{secrets.VSCE_TOKEN}}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"play": "npm -C playground run dev",
"test": "vitest",
"typecheck": "tsc --noEmit",
"release": "bumpp & npm publish & npm -C vscode run publish",
"release": "bumpp -r",
"prepublishOnly": "npm run build"
},
"keywords": [
Expand Down

0 comments on commit 4fc0231

Please sign in to comment.