Skip to content

Commit

Permalink
chore: Add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanpaudel93 committed Jun 24, 2024
1 parent bb8e596 commit 2205af6
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/changeset-version.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// ORIGINALLY FROM CLOUDFLARE WRANGLER:
// https://github.com/cloudflare/wrangler2/blob/main/.github/changeset-version.js

import { exec } from "child_process";
// This script is used by the `release.yml` workflow to update the version of the packages being released.
// The standard step is only to run `changeset version` but this does not update the package-lock.json file.
// So we also run `npm install`, which does this update.
// This is a workaround until this is handled automatically by `changeset version`.
// See https://github.com/changesets/changesets/issues/421.
exec("npx changeset version");
exec("npm install");
19 changes: 19 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI
on:
push:
branches:
- "**"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4
with:
node-version: 18.x
cache: "bun"

- run: bun install --no-frozen-lockfile
- run: bun run build
40 changes: 40 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish
on:
workflow_run:
workflows: ["CI"]
types:
- completed
branches:
- main

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

jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4
with:
node-version: 18.x
cache: "bun"

- name: Install bun Dependencies
run: bun install --no-frozen-lockfile

- name: Build the package
run: bun build

- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
commit: "chore(release): version packages"
title: "chore(release): version packages"
version: node .github/changeset-version.mjs
publish: npx changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 2205af6

Please sign in to comment.