-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (82 loc) · 2.62 KB
/
Copy pathrelease.yml
File metadata and controls
94 lines (82 loc) · 2.62 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
name: Public Release Packaging
on:
push:
tags:
- 'v*'
- 'release-*'
workflow_dispatch:
permissions:
contents: write
jobs:
build-binaries:
name: Build Release Binary
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: tsc
release_name: techscript-linux-x64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: tsc.exe
release_name: techscript-windows-x64
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: tsc
release_name: techscript-macos-x64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: tsc
release_name: techscript-macos-arm64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build target release
run: cargo build --release --target ${{ matrix.target }}
- name: Packaging
shell: bash
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/${{ matrix.artifact_name }} dist/
cd dist
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a ../${{ matrix.release_name }}.zip ${{ matrix.artifact_name }}
else
tar -czvf ../${{ matrix.release_name }}.tar.gz ${{ matrix.artifact_name }}
fi
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.release_name }}
path: ${{ matrix.release_name }}.*
publish-github-release:
name: Publish GitHub Release
needs: build-binaries
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Structure assets
run: |
mkdir assets-dist
find artifacts -type f \( -name "*.zip" -o -name "*.tar.gz" \) -exec cp {} assets-dist/ \;
ls -la assets-dist/
- name: Publish draft release
uses: softprops/action-gh-release@v1
with:
files: assets-dist/*
body_path: README.md
draft: true
prerelease: contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}