-
Notifications
You must be signed in to change notification settings - Fork 6
143 lines (123 loc) · 4.02 KB
/
release.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Build Binaries & Release
on:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
jobs:
call_build_binaries:
uses: ./.github/workflows/build.yml
create_github_release:
needs: [call_build_binaries]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version
id: get_version
run: |
VERSION=$(grep '^version =' crates/fta/Cargo.toml | sed 's/^version = "\(.*\)"/\1/')
echo "Version: $VERSION"
echo "FTA_VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Create GitHub release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: v${{ steps.get_version.outputs.FTA_VERSION }}
draft: true
prerelease: false
- name: Download macOS artifacts
uses: actions/download-artifact@v4
with:
name: macos-binaries
- name: Download windows artifacts
uses: actions/download-artifact@v4
with:
name: windows-binaries
- name: Download linux artifacts
uses: actions/download-artifact@v4
with:
name: linux-binaries
- name: Upload all assets
uses: softprops/action-gh-release@v2
with:
files: |
fta-x86_64-apple-darwin.tar.gz
fta-aarch64-apple-darwin.tar.gz
fta-x86_64-pc-windows-msvc.zip
fta-aarch64-pc-windows-msvc.zip
fta-aarch64-unknown-linux-musl.tar.gz
fta-x86_64-unknown-linux-musl.tar.gz
fta-arm-unknown-linux-musleabi.tar.gz
publish_rust_crate:
runs-on: ubuntu-latest
needs: [create_github_release]
steps:
- uses: actions/checkout@v4
- name: Update packages
run: sudo apt-get update
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
profile: minimal
target: x86_64-unknown-linux-musl
- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish --token $CARGO_REGISTRY_TOKEN
working-directory: crates/fta
publish_fta_cli:
needs: [create_github_release]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- name: Download macOS artifacts
uses: actions/download-artifact@v4
with:
name: macos-binaries
path: artifact/
- name: Download linux artifacts
uses: actions/download-artifact@v4
with:
name: linux-binaries
path: artifact/
- name: Download windows artifacts
uses: actions/download-artifact@v4
with:
name: windows-binaries
path: artifact/
- name: Extract .tar.gz artifacts
run: |
for file in artifact/*.tar.gz; do
base=$(basename -- "$file")
dirname="${base%%.*}"
mkdir -p packages/fta/binaries/"$dirname"
tar -xzf "$file" -C packages/fta/binaries/"$dirname"
done
- name: Extract .zip artifacts
run: |
for file in artifact/*.zip; do
dir=$(basename "$file" .zip)
mkdir -p "packages/fta/binaries/$dir"
unzip -o "$file" -d "packages/fta/binaries/$dir"
done
# List out the binaries dir
ls -R packages/fta/binaries/
- name: Publish to npm
run: npm publish
working-directory: packages/fta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}