-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (69 loc) · 2.38 KB
/
release.yml
File metadata and controls
84 lines (69 loc) · 2.38 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
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:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v6
- 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: Build
run: cargo build --release
- name: Upload build artifact
uses: actions/upload-artifact@v7
with:
name: filectrl-${{ matrix.os }}
path: 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/checkout@v6
- 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-ubuntu-latest/filectrl release-assets/filectrl-linux
cp artifacts/filectrl-macos-latest/filectrl release-assets/filectrl-macos
- name: Create release
uses: softprops/action-gh-release@v2
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