-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (92 loc) · 3.28 KB
/
create-release.yml
File metadata and controls
106 lines (92 loc) · 3.28 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# https://github.com/dirien/rust-cross-compile
name: 2. Create release
on:
workflow_dispatch:
inputs:
tag:
description: "Tag version to build (e.g., v1.0.0)"
required: true
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.platform.os_name }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- os_name: Linux-x86_64
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
bin: anything-cli-linux-amd64
- os_name: macOS-x86_64
os: macOS-latest
target: x86_64-apple-darwin
bin: anything-cli-darwin-amd64
- os_name: macOS-aarch64
os: macOS-latest
target: aarch64-apple-darwin
bin: anything-cli-darwin-arm64
toolchain:
- stable
steps:
- uses: actions/checkout@v4
- name: Build binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: "build"
target: ${{ matrix.platform.target }}
toolchain: ${{ matrix.toolchain }}
args: "--release"
strip: true
- name: Rename binary
run: mv target/${{ matrix.platform.target }}/release/anything-cli target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}
- name: Set executable permissions
run: chmod +x target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}
- name: Compress binary to .tar.gz
run: |
cd target/${{ matrix.platform.target }}/release
tar -czf ${{ matrix.platform.bin }}.tar.gz ${{ matrix.platform.bin }}
- name: Generate SHA-256 checksum
run: |
cd target/${{ matrix.platform.target }}/release
shasum -a 256 ${{ matrix.platform.bin }}.tar.gz | cut -d ' ' -f 1 > ${{ matrix.platform.bin }}.tar.gz.sha256
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform.bin }}
path: |
target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}.tar.gz
target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}.tar.gz.sha256
retention-days: 1
create-release:
name: Create Release
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Prepare release assets
run: |
mkdir -p release-assets
# Copy all tar.gz files and checksums
find ./artifacts -name "*.tar.gz" -exec cp {} release-assets/ \;
find ./artifacts -name "*.tar.gz.sha256" -exec cp {} release-assets/ \;
# Copy install script
cp install/install.sh release-assets/
# List what we're releasing
echo "Release assets:"
ls -la release-assets/
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.tag }}
name: ${{ github.event.inputs.tag }}
draft: false
prerelease: false
generate_release_notes: true
files: release-assets/*