Skip to content

Commit

Permalink
chore(ci): add release ci (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackHole1 authored Oct 25, 2023
1 parent 9ecef2e commit 8ec9ec3
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 1 deletion.
31 changes: 31 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
changelog:
exclude:
labels:
- ignore-for-release
authors:
- octocat
categories:
- title: ⚒️ Breaking
labels:
- Semver-Major
- breaking-change
- title: 🐞 Bugs
labels:
- Semver-Minor
- bug
- title: 🎉 Features
labels:
- Semver-Minor
- enhancement
- feature
- title: 🥷 Refactor
labels:
- Semver-Minor
- refactor
- title: 👒 Dependencies
labels:
- Semver-Minor
- dependencies
- title: Other Changes
labels:
- "*"
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Rlease
on:
push:
tags:
- "v*.*.*"

jobs:
release:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Install Rust
uses: moonrepo/setup-rust@v1

- name: Setup Rust
run: |
rustup install 1.72.1
rustup default 1.72.1
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
- name: Build
run: |
pnpm i
pnpm build
- name: Pack
run: |
pnpm pack
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
lib/*
*.tgz
generate_release_notes: true
draft: false
prerelease: false
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish
run: |
pnpm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

[![Test Service](https://github.com/oomol-lab/mac-power-monitor/actions/workflows/test-service.yml/badge.svg)](https://github.com/oomol-lab/mac-power-monitor/actions/workflows/test-service.yml)

> Inspiration from: [prashantgupta24/mac-sleep-notifier](https://github.com/prashantgupta24/mac-sleep-notifier)
## Install

```shell
pnpm add @oomol-lab/mac-power-monitor
# or
npm install @oomol-lab/mac-power-monitor
# or
yarn add @oomol-lab/mac-power-monitor
```

## Usage

```typescript
import { createMacPowerMonitor } from "@oomol-lab/mac-power-monitor";

Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"name": "@oomol-lab/mac-power-monitor",
"version": "1.0.0",
"description": "macOS Sleep / Wake notifications",
"author": "Tao Zeyu",
"homepage": "https://github.com/oomol-lab/mac-power-monitor",
"license": "MIT",
"type": "commonjs",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -14,7 +17,9 @@
]
}
},
"files": ["lib"],
"files": [
"lib"
],
"scripts": {
"clean": "cargo clean && rimraf lib",
"build": "pnpm clean && ./scripts/cross-build.sh && tsup-node",
Expand Down

0 comments on commit 8ec9ec3

Please sign in to comment.