-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (95 loc) · 3.21 KB
/
Copy pathrelease.yml
File metadata and controls
116 lines (95 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Release
on:
push:
tags:
- 'v*'
permissions:
id-token: write
contents: read
env:
CARGO_TERM_COLOR: always
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build:
strategy:
matrix:
include:
- target: aarch64-apple-darwin
os: macos-latest
package: pdf-translate-darwin-arm64
binary: pdf-translate-core
- target: x86_64-apple-darwin
os: macos-latest
package: pdf-translate-darwin-x64
binary: pdf-translate-core
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
package: pdf-translate-linux-x64-gnu
binary: pdf-translate-core
- target: x86_64-pc-windows-msvc
os: windows-latest
package: pdf-translate-win32-x64
binary: pdf-translate-core.exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Cargo registry and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
target/${{ matrix.target }}
key: cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-${{ matrix.target }}-
- name: Build
run: cargo build --release --target ${{ matrix.target }} --manifest-path crates/core/Cargo.toml
- name: Copy binary to package
shell: bash
run: cp target/${{ matrix.target }}/release/${{ matrix.binary }} packages/${{ matrix.package }}/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.package }}
path: packages/${{ matrix.package }}/
publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
package-manager-cache: false
- uses: pnpm/action-setup@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: Copy binaries to packages
run: |
for pkg in pdf-translate-darwin-arm64 pdf-translate-darwin-x64 pdf-translate-linux-x64-gnu pdf-translate-win32-x64; do
cp artifacts/$pkg/* packages/$pkg/
chmod +x packages/$pkg/pdf-translate-core* || true
done
- name: Publish platform packages
run: |
for pkg in pdf-translate-darwin-arm64 pdf-translate-darwin-x64 pdf-translate-linux-x64-gnu pdf-translate-win32-x64; do
cd packages/$pkg
npm publish --access public --provenance || echo "Skipped $pkg (may already exist)"
cd ../..
done
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Build CLI
run: pnpm --filter pdf-translate build
- name: Publish CLI
run: |
cd packages/cli
npm publish --access public --provenance