-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (76 loc) · 2.63 KB
/
release.yml
File metadata and controls
88 lines (76 loc) · 2.63 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
name: Build and Release
permissions:
contents: write
on:
push:
tags:
- v*
jobs:
build:
strategy:
matrix:
job:
- os: ubuntu-latest
arch: x86_64-unknown-linux-gnu
- os: macos-latest
arch: aarch64-apple-darwin
- os: windows-latest
arch: x86_64-pc-windows-msvc
runs-on: ${{ matrix.job.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
target: ${{ matrix.job.arch }}
- name: Build
run: cargo build --release --target ${{ matrix.job.arch }}
- name: Create archive
if: matrix.job.os == 'ubuntu-latest' || matrix.job.os == 'macos-latest'
run: |
mkdir -p target/artifacts
cp target/${{ matrix.job.arch }}/release/jpksj-to-sql target/artifacts/
cd target/artifacts
zip jpksj-to-sql-${{ matrix.job.arch }}.zip jpksj-to-sql
- name: Create archive (Windows)
if: matrix.job.os == 'windows-latest'
run: |
New-Item -ItemType Directory -Force -Path target/artifacts
cp target/${{ matrix.job.arch }}/release/jpksj-to-sql.exe target/artifacts/
cd target/artifacts
7z a jpksj-to-sql-${{ matrix.job.arch }}.zip jpksj-to-sql.exe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.job.arch }}-release
path: target/artifacts/jpksj-to-sql-${{ matrix.job.arch }}.zip
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact for x86_64-unknown-linux-gnu
uses: actions/download-artifact@v4
with:
name: x86_64-unknown-linux-gnu-release
path: artifacts/x86_64
- name: Download artifact for x86_64-pc-windows-msvc
uses: actions/download-artifact@v4
with:
name: x86_64-pc-windows-msvc-release
path: artifacts/x86_64
- name: Download artifact for aarch64-apple-darwin
uses: actions/download-artifact@v4
with:
name: aarch64-apple-darwin-release
path: artifacts/aarch64
- name: Create Release
uses: softprops/action-gh-release@v2
with:
# Use the tag name without the refs/ prefix
tag_name: ${{ github.ref_name }}
files: |
artifacts/x86_64/jpksj-to-sql-x86_64-unknown-linux-gnu.zip
artifacts/x86_64/jpksj-to-sql-x86_64-pc-windows-msvc.zip
artifacts/aarch64/jpksj-to-sql-aarch64-apple-darwin.zip