Skip to content

Commit 932a74c

Browse files
feat(cd): Add nightly release
1 parent d7cef6d commit 932a74c

File tree

1 file changed

+131
-0
lines changed

1 file changed

+131
-0
lines changed
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Create the nightly release
2+
on:
3+
schedule:
4+
# Take into account lut99's sleep schedule
5+
- cron: 0 4 * * *
6+
7+
# Manual mechanism to bump the nightly in case of a issue with the one from last night
8+
workflow_dispatch:
9+
inputs:
10+
ref:
11+
default: main
12+
required: false
13+
type: string
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
18+
19+
env:
20+
CARGO_INCREMENTAL: 0
21+
CARGO_TERM_COLOR: always
22+
GH_TOKEN: ${{ github.token }}
23+
24+
jobs:
25+
tag:
26+
name: "Add nightly tag"
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
with:
32+
ref: ${{ inputs.ref || 'main' }}
33+
fetch-tags: true
34+
- name: Check if there is anything to be done
35+
run: |
36+
git rev-parse HEAD || true
37+
git rev-parse 'nightly^{commit}' || true
38+
[[ $(git rev-parse HEAD) != $(git rev-parse 'nightly^{commit}') ]]
39+
- name: Tag the latest commit
40+
run: |
41+
git config user.name "Brane"
42+
git config user.email "[email protected]"
43+
git push --delete origin nightly || true
44+
git tag -d nightly || true
45+
git tag -a nightly -m "Nightly release"
46+
git push --tags
47+
48+
build:
49+
name: "Build & package"
50+
needs: tag
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
include:
55+
- runner: ubuntu-latest
56+
os: linux
57+
arch: x86_64
58+
- runner: macos-latest
59+
os: macos
60+
arch: aarch64
61+
- runner: windows-latest
62+
os: windows
63+
arch: x86_64
64+
- runner: ubuntu-24.04-arm
65+
os: linux
66+
arch: aarch64
67+
- runner: macos-13
68+
os: macos
69+
arch: x86_64
70+
71+
runs-on: ${{ matrix.runner }}
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v4
75+
with:
76+
ref: nightly
77+
fetch-tags: true
78+
- name: Set up Docker Buildx
79+
if: ${{ matrix.os == 'linux' }}
80+
uses: docker/setup-buildx-action@v3
81+
- name: Install Go
82+
if: ${{ matrix.os == 'macos' }}
83+
uses: actions/setup-go@v5
84+
with:
85+
go-version: '^1.23.4'
86+
- name: Build xtask
87+
run: |
88+
cargo build --release --no-default-features --package xtask -F ci
89+
- name: Update package version in Cargo.toml
90+
run: |
91+
cargo run --release --no-default-features --package xtask -F ci set-version -p nightly -m '$git_hash$git_dirty'
92+
- name: Build
93+
run: |
94+
cargo run --release --no-default-features --package xtask -F ci build all
95+
- name: Package
96+
run: |
97+
cargo run --release --no-default-features --package xtask -F ci package github
98+
- name: Upload
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: build-${{ matrix.os }}-${{ matrix.arch }}-nightly
102+
path: |
103+
target/package/release/*
104+
if-no-files-found: error
105+
retention-days: 1
106+
107+
release:
108+
name: "Release artifacts to GitHub"
109+
needs: build
110+
runs-on: ubuntu-latest
111+
steps:
112+
- name: Download artifacts
113+
uses: actions/download-artifact@v4
114+
# without further specification, downloads all artifacts from the run
115+
with:
116+
path: release
117+
merge-multiple: true
118+
- name: Delete previous nightly release
119+
run: gh -R $GITHUB_REPOSITORY release delete nightly
120+
- name: Release
121+
uses: softprops/action-gh-release@v2
122+
with:
123+
files: |
124+
release/*
125+
fail_on_unmatched_files: true
126+
tag_name: nightly
127+
name: Nightly
128+
prerelease: true
129+
body: This is the nightly (daily) release of Brane. This build can occasionally break. Do not use in production.
130+
draft: false
131+
make_latest: false

0 commit comments

Comments
 (0)