-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (102 loc) · 3.62 KB
/
Copy pathrelease.yml
File metadata and controls
125 lines (102 loc) · 3.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
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
name: Release
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Install XCB dependencies
run: sudo apt-get update && sudo apt-get install -y libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
- name: Check formatting
run: cargo fmt --check
- name: Lint
run: cargo clippy -- -D warnings
- name: Run tests
run: cargo test
- name: Check dependencies
uses: EmbarkStudios/cargo-deny-action@v2
build:
needs: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: filectrl-linux
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: filectrl-macos
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: filectrl-macos-arm64
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Install XCB dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
- name: Add Rust target
run: rustup target add ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Upload build artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact_name }}
path: target/${{ matrix.target }}/release/filectrl
release:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Delete previous dev release
if: github.ref == 'refs/heads/main'
run: |
gh release delete dev --yes || true
git push --delete origin refs/tags/dev || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download build artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir release-assets
cp artifacts/filectrl-linux/filectrl release-assets/filectrl-linux
cp artifacts/filectrl-macos/filectrl release-assets/filectrl-macos
cp artifacts/filectrl-macos-arm64/filectrl release-assets/filectrl-macos-arm64
- name: Create release
uses: softprops/action-gh-release@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref == 'refs/heads/main' && 'dev' || github.ref_name }}
name: ${{ github.ref == 'refs/heads/main' && 'dev' || github.ref_name }}
body: ${{ github.ref == 'refs/heads/main' && 'Latest build from main branch' || '' }}
make_latest: ${{ github.ref == 'refs/heads/main' && 'false' || 'true' }}
files: |
release-assets/filectrl-linux
release-assets/filectrl-macos
release-assets/filectrl-macos-arm64