-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (82 loc) · 3.03 KB
/
pre-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
name: Pre-Release
on:
workflow_dispatch:
inputs:
major_version:
description: 'Major Ver.'
required: true
type: string
default: '0.0'
jobs:
create_release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.set_output.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
if: github.event_name == 'workflow_dispatch'
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.major_version }}.${{ github.run_number }}
release_name: v${{ github.event.inputs.major_version }}.${{ github.run_number }}
draft: false
prerelease: true
- name: Set output
id: set_output
run: echo "upload_url=${{ steps.create_release.outputs.upload_url }}" >> "$GITHUB_OUTPUT"
build:
runs-on: ${{ matrix.os }}
needs: create_release
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [stable]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build
run: cargo build --release
- name: Package (Linux)
if: matrix.os == 'ubuntu-latest'
run: tar -czvf ./target/release/ratisui-linux-amd64.tar.gz LICENSE README.md -C ./target/release ratisui
- name: Package (Mac)
if: matrix.os == 'macos-latest'
run: tar -czvf ./target/release/ratisui-mac.tar.gz LICENSE README.md -C ./target/release ratisui
- name: Package (Windows)
if: matrix.os == 'windows-latest'
run: Compress-Archive -Path '.\README.md', '.\LICENSE', '.\target\release\ratisui.exe' -DestinationPath '.\target\release\ratisui-windows-amd64.zip'
- name: Upload Release Asset (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./target/release/ratisui-linux-amd64.tar.gz
asset_name: ratisui-linux-amd64.tar.gz
asset_content_type: application/octet-stream
- name: Upload Release Asset (Mac)
if: matrix.os == 'macos-latest'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./target/release/ratisui-mac.tar.gz
asset_name: ratisui-mac.tar.gz
asset_content_type: application/octet-stream
- name: Upload Release Asset (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: .\target\release\ratisui-windows-amd64.zip
asset_name: ratisui-windows-amd64.zip
asset_content_type: application/octet-stream