-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (64 loc) · 2.28 KB
/
release.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
name: Daily Build and Release
on:
schedule:
- cron: '0 12 * * *'
workflow_dispatch:
jobs:
release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Install required Rust components
run: |
rustup component add rust-src --toolchain nightly
rustup component add llvm-tools-preview --toolchain nightly
- name: Install bootimage
run: cargo install bootimage
- name: Check if there are new commits
id: check_commits
run: |
last_release=$(gh release list --limit 1 --json tagName -q '.[0].tagName' || echo "")
if [ -n "$last_release" ]; then
commits_since=$(git rev-list ${last_release}..HEAD --count)
else
commits_since=$(git rev-list HEAD --count)
fi
echo "commits_since=$commits_since" >> $GITHUB_ENV
- name: Skip if no new commits
if: ${{ env.commits_since == '0' }}
run: echo "No new commits since the last release. Skipping build and release."
- name: Build the kernel
if: ${{ env.commits_since != '0' }}
run: cargo bootimage
- name: Generate release tag
if: ${{ env.commits_since != '0' }}
id: generate_tag
run: |
today=$(date -u +%Y.%m.%d)
echo "release_tag=$today" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
uses: actions/[email protected]
with:
tag_name: ${{ env.release_tag }}
release_name: Release ${{ env.release_tag }}
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Asset
if: ${{ env.commits_since != '0' }}
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/x86_64-infinity_os/debug/bootimage-infinity_os.bin
asset_name: bootimage-infinity_os.bin
asset_content_type: application/octet-stream