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(ci): add release ci #3

Merged
merged 1 commit into from
Oct 25, 2023
Merged
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
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