Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add test automation and release to CI #20

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Release

on:
release:
types: [published]

workflow_dispatch:

jobs:
tests:
uses: ./.github/workflows/tests.yml

publish-npm:
needs: [tests]
if: (github.event_name == 'workflow_dispatch') || (github.event_name == 'release' && contains(github.ref, 'refs/tags/'))
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up node
uses: actions/setup-node@v4

- name: Install dependencies
run: yarn install

- name: Build
run: yarn build

- name: Publish to npm
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-jsr:
needs: [tests]
if: (github.event_name == 'workflow_dispatch') || (github.event_name == 'release' && contains(github.ref, 'refs/tags/'))
runs-on: ubuntu-latest

permissions:
contents: write
id-token: write

steps:
- uses: actions/checkout@v4
with:
ref: main

- uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: yarn install

- name: Build
run: yarn build

- name: Get NPM version
id: package-version
uses: martinbeentjes/[email protected]

- name: Update JSR version
uses: jossef/[email protected]
with:
file: jsr.json
field: version
value: ${{ steps.package-version.outputs.current-version}}

- name: Commit JSR version
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: 'Update JSR version to ${{ steps.package-version.outputs.current-version}}'
add: 'jsr.json'

- name: Publish package
run: npx jsr publish
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test
on: [workflow_call, push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up node
uses: actions/setup-node@v4

- name: Install depedencies
run: npm install

- name: Lint
run: npm run lint

- name: Build
run: npm run build
5 changes: 5 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@hookdeck/vercel",
"version": "0.1.4",
"exports": "./index.ts"
}
Loading