-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (63 loc) · 1.89 KB
/
release.yml
File metadata and controls
74 lines (63 loc) · 1.89 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
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
artifact_name: rust-clock-cli-linux-amd64
- os: windows-latest
artifact_name: rust-clock-cli-windows-amd64.exe
- os: macos-latest
artifact_name: rust-clock-cli-macos-amd64
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Build binary
run: cargo build --release --locked
- name: Prepare artifact for Linux and macOS
if: matrix.os != 'windows-latest'
run: mv target/release/rust-clock-cli ${{ matrix.artifact_name }}
- name: Prepare artifact for Windows
if: matrix.os == 'windows-latest'
run: mv target/release/rust-clock-cli.exe ${{ matrix.artifact_name }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_name }}
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/rust-clock-cli-linux-amd64/*
artifacts/rust-clock-cli-windows-amd64.exe/*
artifacts/rust-clock-cli-macos-amd64/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}