-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (104 loc) · 3.41 KB
/
Copy pathrelease.yaml
File metadata and controls
120 lines (104 loc) · 3.41 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
tag:
description: "Tag to release (e.g. v0.2.0-rc.1)"
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
jobs:
build:
name: build / ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
steps:
- name: checkout
uses: actions/checkout@v5
- name: set up rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: build
run: cargo build --release --locked --target ${{ matrix.target }} -p ferris-ctl
- name: resolve tag name
id: tag
shell: bash
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "name=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "name=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
fi
- name: package (unix)
if: matrix.os != 'windows-latest'
shell: bash
run: |
archive="ferris-ctl-${{ steps.tag.outputs.name }}-${{ matrix.target }}.tar.gz"
tar -C "target/${{ matrix.target }}/release" -czf "${archive}" ferris-ctl
echo "ASSET=${archive}" >> "$GITHUB_ENV"
- name: package (windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$archive = "ferris-ctl-${{ steps.tag.outputs.name }}-${{ matrix.target }}.zip"
Compress-Archive -Path "target/${{ matrix.target }}/release/ferris-ctl.exe" -DestinationPath $archive
"ASSET=$archive" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.target }}
path: ${{ env.ASSET }}
retention-days: 1
release:
name: github release
needs: build
# Publish the release as long as the run wasn't cancelled, even if one
# build target failed — a release with the binaries that did build beats
# no release at all. Missing assets are visible in the Actions run.
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v5
- name: resolve tag name
id: tag
shell: bash
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "name=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "name=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
fi
- name: download all artifacts
uses: actions/download-artifact@v4
with:
pattern: binary-*
merge-multiple: true
path: artifacts
- name: create checksums
working-directory: artifacts
run: sha256sum * > SHA256SUMS.txt
- name: publish github release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.name }}
prerelease: ${{ contains(steps.tag.outputs.name, '-rc') }}
generate_release_notes: true
files: |
artifacts/*