Skip to content

Commit 898cfa2

Browse files
committedOct 23, 2024
feat: Add .github/workflows/pre-release.yml workflow
1 parent 5ac916d commit 898cfa2

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed
 

‎.github/workflows/nightly-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ name: Nightly Build
1010
on:
1111
push:
1212
branches:
13-
- nightly # Just for test purpose only with the nightly repo
13+
- nightly0 # Just for test purpose only with the nightly repo
1414
# This schedule will run only from the default branch
1515
schedule:
1616
- cron: '15 0 * * *' # run at 00:15 AM UTC

‎.github/workflows/pre-release.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Pre Release
2+
3+
on:
4+
# This schedule will run only from the default branch
5+
schedule:
6+
- cron: '30 1 * * *' # run at 00:15 AM UTC
7+
workflow_dispatch:
8+
inputs:
9+
force:
10+
type: boolean
11+
default: false
12+
required: false
13+
description: 'Force Run'
14+
15+
defaults:
16+
run:
17+
shell: bash
18+
19+
jobs:
20+
pre-release:
21+
name: Pre Release
22+
runs-on: ubuntu-latest
23+
if: github.repository == 'nushell/nightly'
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
ref: main
29+
fetch-depth: 0
30+
# Configure PAT here: https://github.com/settings/tokens for the push operation in the following steps
31+
token: ${{ secrets.WORKFLOW_TOKEN }}
32+
33+
- name: Setup Nushell
34+
uses: hustcer/setup-nu@v3
35+
with:
36+
version: 0.99.0
37+
38+
# Synchronize the main branch of nightly repo with the main branch of Nushell official repo
39+
- name: Pre Release
40+
shell: nu {0}
41+
run: |
42+
cd $env.GITHUB_WORKSPACE
43+
git checkout main
44+
# We can't push if no user name and email are configured
45+
git config user.name 'hustcer'
46+
git config user.email 'hustcer@outlook.com'
47+
git pull origin main
48+
git remote add src https://github.com/nushell/nushell.git
49+
git fetch src main
50+
# All the changes will be overwritten by the upstream main branch
51+
git reset --hard src/main
52+
git push origin main -f
53+
let version = open Cargo.toml | get package.version
54+
let tag_name = $'($version)-pre'
55+
if (git ls-remote --tags origin $tag_name | is-empty) {
56+
git tag -a $tag_name -m $'Pre release from Nushell main branch'
57+
git push origin --tags
58+
}

0 commit comments

Comments
 (0)
Please sign in to comment.