-
Notifications
You must be signed in to change notification settings - Fork 2
127 lines (114 loc) · 3.63 KB
/
rust.yaml
File metadata and controls
127 lines (114 loc) · 3.63 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
name: Rust Build and Test
on:
push:
branches:
- master
pull_request_target:
workflow_dispatch:
release:
types: [created, edited]
permissions:
pull-requests: write
jobs:
#run build first to populate caches
build-windows:
name: Build Windows binary
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: build
args: --workspace --all-targets --all-features --release
- name: Check for release
id: is-release
shell: bash
run: |
unset IS_RELEASE
if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true'; fi
echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT
- name: Artifact upload (Windows)
uses: actions/upload-artifact@master
with:
name: rust_cat.exe
path: target/release/rust_cat.exe
- name: Publish archives and packages (Windows)
uses: softprops/action-gh-release@v1
if: steps.is-release.outputs.IS_RELEASE
with:
files: |
target/release/rust_cat.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create universal macOS app bundle
build-macos:
name: Create universal macOS app bundle
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Run macOS build script
run: ./build_macos.sh
- name: Check for release
id: is-release
shell: bash
run: |
unset IS_RELEASE
if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true'; fi
echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT
- name: Upload universal app bundle
uses: actions/upload-artifact@v4
with:
name: RustCat-universal.app.zip
path: RustCat-universal.app.zip
- name: Upload universal DMG
uses: actions/upload-artifact@v4
with:
name: RustCat-universal.dmg
path: RustCat-universal.dmg
- name: Publish universal macOS release
uses: softprops/action-gh-release@v1
if: steps.is-release.outputs.IS_RELEASE
with:
files: |
RustCat-universal.app.zip
RustCat-universal.dmg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Auto-approve Dependabot PRs if build succeeds
dependabot-auto-approve:
runs-on: ubuntu-latest
needs: [build-windows, build-macos]
if: github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target'
steps:
- name: Auto-approve PR
uses: hmarr/auto-approve-action@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}