Skip to content

Commit 62f2931

Browse files
feat(cd): Add nightly release
1 parent d7cef6d commit 62f2931

File tree

1 file changed

+125
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)