Skip to content

Commit

Permalink
ci: 👷 add actions for linting, versioning, and publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecBlance committed Oct 11, 2024
1 parent 411f735 commit df640d3
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CI
on:
push:
branches:
- "**"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run lint && npm run build
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish
on:
workflow_run:
workflows: [CI]
branches: [main]
types: [completed]

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
pull-requests: write

jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
- run: npm ci
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build": "tsup index.ts --format cjs,esm --dts",
"dev": "nodemon index.ts",
"dev-sample": "nodemon sample/index.ts",
"lint": "tsc"
"lint": "tsc",
"release": "npm run build && changeset publish"
},
"keywords": [
"google",
Expand Down

0 comments on commit df640d3

Please sign in to comment.