Repository navigation
84 lines (77 loc) · 3.02 KB
/
Copy pathrelease.yml
File metadata and controls
84 lines (77 loc) · 3.02 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
name: Release
on:
push:
branches: [main]
permissions:
contents: write
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.v.outputs.version }}
steps:
- id: v
run: echo "version=$(date +'%Y.%m.%d')-$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_OUTPUT
build-linux-x86_64:
runs-on: ubuntu-latest
needs: version
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --release --features=cli --locked
- run: tar czf scratch-git-${{ needs.version.outputs.version }}-linux-x86_64.tar.gz -C target/release scratch-git
- uses: actions/upload-artifact@v4
with:
name: linux-x86_64
path: scratch-git-${{ needs.version.outputs.version }}-linux-x86_64.tar.gz
build-linux-aarch64:
runs-on: ubuntu-latest
needs: version
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-unknown-linux-gnu
- run: sudo apt-get install -y gcc-aarch64-linux-gnu
- run: |
mkdir -p .cargo
echo '[target.aarch64-unknown-linux-gnu]' >> .cargo/config.toml
echo 'linker = "aarch64-linux-gnu-gcc"' >> .cargo/config.toml
- run: cargo build --release --features=cli --locked --target aarch64-unknown-linux-gnu
- run: tar czf scratch-git-${{ needs.version.outputs.version }}-linux-aarch64.tar.gz -C target/aarch64-unknown-linux-gnu/release scratch-git
- uses: actions/upload-artifact@v4
with:
name: linux-aarch64
path: scratch-git-${{ needs.version.outputs.version }}-linux-aarch64.tar.gz
build-windows-x86_64:
runs-on: windows-latest
needs: version
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- run: cargo build --release --features=cli --locked --target x86_64-pc-windows-msvc
- run: Compress-Archive -Path target/x86_64-pc-windows-msvc/release/scratch-git.exe -DestinationPath scratch-git-${{ needs.version.outputs.version }}-windows-x86_64.zip
- uses: actions/upload-artifact@v4
with:
name: windows-x86_64
path: scratch-git-${{ needs.version.outputs.version }}-windows-x86_64.zip
release:
runs-on: ubuntu-latest
needs: [version, build-linux-x86_64, build-linux-aarch64, build-windows-x86_64]
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.version.outputs.version }}
name: Release ${{ needs.version.outputs.version }}
draft: false
prerelease: false
generate_release_notes: true
files: |
scratch-git-${{ needs.version.outputs.version }}-linux-x86_64.tar.gz
scratch-git-${{ needs.version.outputs.version }}-linux-aarch64.tar.gz
scratch-git-${{ needs.version.outputs.version }}-windows-x86_64.zip