Repository navigation
149 lines (129 loc) · 4.41 KB
/
Copy pathrelease.yml
File metadata and controls
149 lines (129 loc) · 4.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
tickets:
name: Artifact tickets
runs-on: [self-hosted, s31]
outputs:
tickets: ${{ steps.t.outputs.tickets }}
steps:
- id: t
uses: Ankara-Software/ci-actions/artifact-ticket@v1
with:
names: logrustate-linux-x64 logrustate-linux-arm64 logrustate-darwin-x64 logrustate-darwin-arm64 logrustate-win32-x64.exe
hours: "6"
build:
name: Build - ${{ matrix.target }}
needs: tickets
runs-on: ${{ fromJSON(matrix.runner) }}
strategy:
matrix:
include:
- os: linux
runner: '["self-hosted","s31"]'
target: x86_64-unknown-linux-gnu
asset_name: logrustate-linux-x64
use_cross: false
- os: linux
runner: '["self-hosted","s31"]'
target: aarch64-unknown-linux-gnu
asset_name: logrustate-linux-arm64
use_cross: true
- os: macos
runner: '["self-hosted","macOS","s11"]'
target: x86_64-apple-darwin
asset_name: logrustate-darwin-x64
use_cross: false
- os: macos
runner: '["self-hosted","macOS","s11"]'
target: aarch64-apple-darwin
asset_name: logrustate-darwin-arm64
use_cross: false
- os: windows
runner: '["self-hosted","Windows","s18"]'
target: x86_64-pc-windows-msvc
asset_name: logrustate-win32-x64.exe
use_cross: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install Cross (if required)
if: matrix.use_cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build binary (Standard)
if: ${{ !matrix.use_cross }}
run: cargo build --target ${{ matrix.target }} --release
- name: Build binary (Cross)
if: matrix.use_cross
run: cross build --target ${{ matrix.target }} --release
- name: Prepare asset (Windows)
if: matrix.os == 'windows'
run: |
mv target\${{ matrix.target }}\release\logrustate.exe ${{ matrix.asset_name }}
- name: Prepare asset (Unix)
if: matrix.os != 'windows'
run: |
mv target/${{ matrix.target }}/release/logrustate ${{ matrix.asset_name }}
- name: Upload Artifact
uses: Ankara-Software/ci-actions/artifact-upload@v1
with:
name: ${{ matrix.asset_name }}
path: ${{ matrix.asset_name }}
ticket: ${{ toJSON(fromJSON(needs.tickets.outputs.tickets)[matrix.asset_name]) }}
release:
name: Create GitHub Release
needs: build
runs-on: [self-hosted, s31]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download logrustate-linux-x64
uses: Ankara-Software/ci-actions/artifact-download@v1
with:
name: logrustate-linux-x64
path: ./artifacts
- name: Download logrustate-linux-arm64
uses: Ankara-Software/ci-actions/artifact-download@v1
with:
name: logrustate-linux-arm64
path: ./artifacts
- name: Download logrustate-darwin-x64
uses: Ankara-Software/ci-actions/artifact-download@v1
with:
name: logrustate-darwin-x64
path: ./artifacts
- name: Download logrustate-darwin-arm64
uses: Ankara-Software/ci-actions/artifact-download@v1
with:
name: logrustate-darwin-arm64
path: ./artifacts
- name: Download logrustate-win32-x64.exe
uses: Ankara-Software/ci-actions/artifact-download@v1
with:
name: logrustate-win32-x64.exe
path: ./artifacts
- name: Flatten artifacts directory
run: |
mkdir dist
find ./artifacts -type f -exec cp {} ./dist/ \;
ls -la ./dist/
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v1
with:
files: |
dist/logrustate-linux-x64
dist/logrustate-linux-arm64
dist/logrustate-darwin-x64
dist/logrustate-darwin-arm64
dist/logrustate-win32-x64.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}