Skip to content

Commit

Permalink
chore: add release.ci (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
callqh authored Apr 11, 2024
1 parent a58ec27 commit 14dc98e
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 41 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -451,44 +451,3 @@ jobs:
name: bindings-universal-apple-darwin
path: ${{ env.APP_NAME }}.*.node
if-no-files-found: error
publish:
name: Publish
runs-on: ubuntu-latest
if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || (github.event.pull_request.base.ref == 'main' && github.event.pull_request.merged == true)
needs:
- build-freebsd
- test-macOS-windows-binding
- test-linux-x64-gnu-binding
- test-linux-x64-musl-binding
- test-linux-aarch64-gnu-binding
- test-linux-aarch64-musl-binding
- test-linux-arm-gnueabihf-binding
- universal-macOS
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
check-latest: true
- name: Install dependencies
run: npm install -g [email protected] && pnpm install --no-frozen-lockfile

- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Move artifacts
run: pnpm artifacts
- name: List packages
run: ls -R ./npm
shell: bash
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
version: pnpm run bump
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
52 changes: 52 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish packages to npm

permissions:
pull-requests: write
contents: write


on:
push:
branches:
- main

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

jobs:
call-rust-build:
uses: ./.github/workflows/CI.yaml

release:
name: Release
needs: [call-rust-build]
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3

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

- name: Install Dependencies
run: npm install -g [email protected] && pnpm i --frozen-lockfile

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Move Artifacts
run: pnpm artifacts

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
version: pnpm run bump
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ members = ["crates/*"]
edition = "2021"
name = "farmfe-enhanced-magic-string"
version = "0.0.0"
publish = false

[lib]
crate-type = ["cdylib"]
Expand Down
1 change: 1 addition & 0 deletions crates/enhanced-magic-string/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ description = "Rust based magic-string implementation with sourcemap chains supp
authors = ["brightwu(吴明亮) <[email protected]>"]
license = "MIT"
repository = "https://github.com/farm-fe/enhanced-magic-string"
git_release_enable = true

[dependencies]
sourcemap = "6.2.3"
Expand Down

0 comments on commit 14dc98e

Please sign in to comment.