-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (81 loc) · 3.17 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
name: Release
on:
push:
tags:
- "*.*.*"
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
# Build for Linux
- name: Build (Linux)
working-directory: seedelf-cli
run: cargo build --release
# Generate checksum (Linux)
- name: Generate checksum (Linux)
working-directory: seedelf-cli
run: sha256sum target/release/seedelf-cli > seedelf-cli-linux.sha256
# Create a GitHub Release
- name: Create GitHub Release
id: create_github_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
body: "Automated release of seedelf-cli."
- name: Upload Linux Binary
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_github_release.outputs.upload_url }}
asset_path: seedelf-cli/target/release/seedelf-cli
asset_name: seedelf-cli-linux
asset_content_type: application/octet-stream
- name: Upload Linux Checksum
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_github_release.outputs.upload_url }}
asset_path: seedelf-cli/seedelf-cli-linux.sha256
asset_name: seedelf-cli-linux.sha256
asset_content_type: text/plain
build-windows:
runs-on: windows-latest
steps:
- name: Check out the code
uses: actions/checkout@v3
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
# Build for Windows
- name: Build (Windows)
working-directory: seedelf-cli
run: cargo build --release --target x86_64-pc-windows-gnu
- name: Generate checksum (Windows)
shell: pwsh
working-directory: seedelf-cli
run: |
$hash = Get-FileHash target\x86_64-pc-windows-gnu\release\seedelf-cli.exe -Algorithm SHA256
$hash.Hash | Out-File -Encoding ASCII seedelf-cli-windows.sha256
# Update the existing GitHub Release (the release is already created by the linux job)
- name: Update GitHub Release with Windows Assets
id: update_github_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
# Optional: if you don't provide a body here, it won't overwrite the previous body.
# body: "Windows build of seedelf-cli added."
- name: Upload Windows Binary
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.update_github_release.outputs.upload_url }}
asset_path: seedelf-cli/target/x86_64-pc-windows-gnu/release/seedelf-cli.exe
asset_name: seedelf-cli-windows.exe
asset_content_type: application/octet-stream
- name: Upload Windows Checksum
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.update_github_release.outputs.upload_url }}
asset_path: seedelf-cli/seedelf-cli-windows.sha256
asset_name: seedelf-cli-windows.sha256
asset_content_type: text/plain