-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (74 loc) · 2.38 KB
/
ci.yml
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
name: ci
on:
push:
pull_request:
schedule: [cron: "40 1 * * *"]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
assign:
name: assign build_id
runs-on: ubuntu-latest
steps:
- run: wget https://github.com/trevyn/animal-time/releases/latest/download/animal-time
- run: chmod +x animal-time
- run: ./animal-time > build_id
- run: cat build_id
- uses: actions/upload-artifact@v4
with:
name: build_id
path: build_id
build:
needs: [assign]
name: build rust ${{ matrix.rust }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
rust: [nightly]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- run: cat build_id/build_id
- run: echo "BUILD_ID=$(cat build_id/build_id)" >> $GITHUB_ENV
- run: rustup default ${{ matrix.rust }} && rustup update ${{ matrix.rust }}
- run: sudo apt-get update
if: ${{ matrix.os == 'ubuntu-latest' }}
- run: sudo apt-get install libgtk-3-dev libasound2-dev
if: ${{ matrix.os == 'ubuntu-latest' }}
- run: cargo build --release
- run: ls
- run: ls
working-directory: target
- run: ls
working-directory: target/release
- run: mv target/release/brace brace
if: ${{ matrix.os != 'windows-latest' }}
- run: mv target/release/brace.exe brace
if: ${{ matrix.os == 'windows-latest' }}
- uses: actions/upload-artifact@v4
if: ${{ matrix.rust == 'nightly' }}
with:
name: ${{ matrix.os }}
path: brace
# - run: zip -9 brace.zip brace
release:
permissions:
contents: write
needs: [assign, build]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- run: cat build_id/build_id
- run: echo "BUILD_ID=$(cat build_id/build_id)" >> $GITHUB_ENV
- run: |
mv macos-latest/brace brace
mv windows-latest/brace brace.exe
- run: gh release create ${{ env.BUILD_ID }} --target ${{ github.sha }} --generate-notes brace brace.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}