Skip to content

Commit 3a11d9b

Browse files
feat(cd): Add nightly release
1 parent d7cef6d commit 3a11d9b

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
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) != $(git rev-parse nightly) ]]
37+
- name: Tag the latest commit
38+
run: |
39+
git config user.name "Brane"
40+
git config user.email "[email protected]"
41+
git push --delete origin nightly || true
42+
git tag -d nightly || true
43+
git tag -a nightly -m "Nightly release"
44+
git push --tags
45+
46+
build:
47+
name: "Build & package"
48+
needs: tag
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
include:
53+
- runner: ubuntu-latest
54+
os: linux
55+
arch: x86_64
56+
- runner: macos-latest
57+
os: macos
58+
arch: aarch64
59+
- runner: windows-latest
60+
os: windows
61+
arch: x86_64
62+
- runner: ubuntu-24.04-arm
63+
os: linux
64+
arch: aarch64
65+
- runner: macos-13
66+
os: macos
67+
arch: x86_64
68+
69+
runs-on: ${{ matrix.runner }}
70+
steps:
71+
- name: Checkout
72+
uses: actions/checkout@v4
73+
with:
74+
ref: nightly
75+
fetch-tags: true
76+
- name: Set up Docker Buildx
77+
if: ${{ matrix.os == 'linux' }}
78+
uses: docker/setup-buildx-action@v3
79+
- name: Install Go
80+
if: ${{ matrix.os == 'macos' }}
81+
uses: actions/setup-go@v5
82+
with:
83+
go-version: '^1.23.4'
84+
- name: Update package version in Cargo.toml
85+
run: |
86+
cargo run --release --no-default-features --package xtask set-version -p nightly -m '$git_hash$git_dirty'
87+
- name: Build
88+
run: |
89+
cargo run --release --no-default-features --package xtask build all
90+
- name: Package
91+
run: |
92+
cargo run --release --no-default-features --package xtask package github
93+
- name: Upload
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: build-${{ matrix.os }}-${{ matrix.arch }}-nightly
97+
path: |
98+
target/package/release/*
99+
if-no-files-found: error
100+
retention-days: 1
101+
102+
release:
103+
name: "Release artifacts to GitHub"
104+
needs: build
105+
runs-on: ubuntu-latest
106+
steps:
107+
- name: Download artifacts
108+
uses: actions/download-artifact@v4
109+
# without further specification, downloads all artifacts from the run
110+
with:
111+
path: release
112+
merge-multiple: true
113+
- name: Delete previous nightly release
114+
run: gh -R $GITHUB_REPOSITORY release delete nightly
115+
- name: Release
116+
uses: softprops/action-gh-release@v2
117+
with:
118+
files: |
119+
release/*
120+
fail_on_unmatched_files: true
121+
tag_name: nightly
122+
name: Nightly
123+
prerelease: true
124+
body: This is the nightly (daily) release of Brane. This build can occasionally break. Do not use in production.
125+
draft: false
126+
make_latest: false

0 commit comments

Comments
 (0)