ci: Gitea actions (#8)
All checks were successful
Build and Publish / build (push) Successful in 51s

Reviewed-on: #8
Co-authored-by: 鲁树人 <lu.shuren@um-react.app>
Co-committed-by: 鲁树人 <lu.shuren@um-react.app>
This commit is contained in:
鲁树人 2025-02-23 17:53:19 +00:00 committed by 鲁树人
parent 4c1bcf8fd5
commit acf3a814bd
4 changed files with 46 additions and 40 deletions

View File

@ -1,38 +0,0 @@
kind: pipeline
type: docker
name: default
when:
event:
- push
- pull_request
- tag
steps:
- name: test
image: rust:1.81-bookworm
commands:
- cargo test --verbose --all
- name: build (wasm_pack)
image: rust:1.81-bookworm
commands:
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- (cd um_wasm && wasm-pack build --release --target web --out-dir ../um_wasm_loader/pkg)
- name: build (node)
image: node:22.9-bookworm
environment:
NPM_TOKEN:
from_secret: NPM_TOKEN
COREPACK_ENABLE_AUTO_PIN: 0
BUILD_SKIP_WASM_PACK: 1
depends_on:
- "build (wasm_pack)"
commands:
- corepack enable
- cd um_wasm_loader
- pnpm i
- pnpm build
- ./ci_publish.sh

View File

@ -0,0 +1,44 @@
name: Build and Publish
on:
push:
branches:
- main
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
env:
COREPACK_ENABLE_AUTO_PIN: 0
BUILD_SKIP_WASM_PACK: 1
steps:
- name: Check out repository code
uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Test
run: cargo test --verbose --all
- name: Setup wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build (rust to wasm)
run: |
cd um_wasm
wasm-pack build --release --target web --out-dir ../um_wasm_loader/pkg
- name: Setup pnpm
uses: pnpm/action-setup@v4.0.0
with:
standalone: true
package_json_file: um_wasm_loader/package.json
run_install: |
- cwd: um_wasm_loader
args: [--frozen-lockfile, --strict-peer-dependencies]
- name: Build (wasm)
working-directory: um_wasm_loader
run: pnpm build
- name: Publish
working-directory: um_wasm_loader
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: ./ci_publish.sh

View File

@ -1,6 +1,6 @@
#!/bin/bash
if [[ -z "${DRONE_TAG}" ]]; then
if [[ ! "$GITHUB_REF" =~ ^refs/tags/ ]]; then
echo "skip package publish, pack only."
pnpm pack
exit 0

View File

@ -1,5 +1,5 @@
{
"packageManager": "pnpm@9.12.1+sha512.e5a7e52a4183a02d5931057f7a0dbff9d5e9ce3161e33fa68ae392125b79282a8a8a470a51dfc8a0ed86221442eb2fb57019b0990ed24fab519bf0e1bc5ccfc4",
"packageManager": "pnpm@10.4.0",
"name": "@unlock-music/crypto",
"version": "0.1.2",
"description": "Project Unlock Music: 加解密支持库",