-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (93 loc) · 2.95 KB
/
Publish.yml
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
name: Publish
on:
workflow_dispatch:
push:
tags:
- 'v*'
jobs:
build-rs:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
target: x86_64-apple-darwin
code-target: darwin-x64
- os: macos-latest
target: aarch64-apple-darwin
code-target: darwin-arm64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
code-target: linux-x64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
code-target: linux-arm64
rustflags: 'RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc"'
setup: "sudo apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu"
- os: windows-latest
target: x86_64-pc-windows-msvc
code-target: win32-x64
- os: windows-latest
target: aarch64-pc-windows-msvc
code-target: win32-arm64
name: Build ${{ matrix.code-target }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Install
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Build Setup
if: ${{ matrix.setup }}
run: ${{ matrix.setup }}
- name: Build
run: ${{ matrix.rustflags }} cargo build --release -p camer --target ${{ matrix.target }}
- name: Copy CLI binary
if: matrix.os == 'windows-latest'
run: |
mkdir dist
cp target/${{ matrix.target }}/release/camer.exe ./dist/camer-${{ matrix.code-target }}.exe
- name: Copy CLI binary
if: matrix.os != 'windows-latest'
run: |
mkdir dist
cp target/${{ matrix.target }}/release/camer ./dist/camer-${{ matrix.code-target }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: camer
path: ./dist/camer-*
final-publish:
name: "Publish To NPM"
runs-on: ubuntu-latest
needs: [build-rs]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 6.15.1
- name: Use Node v16
uses: actions/setup-node@v3
with:
node-version: v16
registry-url: https://registry.npmjs.org/
cache: "pnpm"
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: camer
path: npm/bin/
- name: Generate npm package
run: node npm/camer/scripts/generate-packages.mjs
- name: Publish npm packages
run: sh scripts/publish.sh
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}