Skip to content

Commit

Permalink
feat: Add .github/workflows/pre-release.yml workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcer committed Oct 23, 2024
1 parent 5ac916d commit 898cfa2
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name: Nightly Build
on:
push:
branches:
- nightly # Just for test purpose only with the nightly repo
- nightly0 # Just for test purpose only with the nightly repo
# This schedule will run only from the default branch
schedule:
- cron: '15 0 * * *' # run at 00:15 AM UTC
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Pre Release

on:
# This schedule will run only from the default branch
schedule:
- cron: '30 1 * * *' # run at 00:15 AM UTC
workflow_dispatch:
inputs:
force:
type: boolean
default: false
required: false
description: 'Force Run'

defaults:
run:
shell: bash

jobs:
pre-release:
name: Pre Release
runs-on: ubuntu-latest
if: github.repository == 'nushell/nightly'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
# Configure PAT here: https://github.com/settings/tokens for the push operation in the following steps
token: ${{ secrets.WORKFLOW_TOKEN }}

- name: Setup Nushell
uses: hustcer/setup-nu@v3
with:
version: 0.99.0

# Synchronize the main branch of nightly repo with the main branch of Nushell official repo
- name: Pre Release
shell: nu {0}
run: |
cd $env.GITHUB_WORKSPACE
git checkout main
# We can't push if no user name and email are configured
git config user.name 'hustcer'
git config user.email '[email protected]'
git pull origin main
git remote add src https://github.com/nushell/nushell.git
git fetch src main
# All the changes will be overwritten by the upstream main branch
git reset --hard src/main
git push origin main -f
let version = open Cargo.toml | get package.version
let tag_name = $'($version)-pre'
if (git ls-remote --tags origin $tag_name | is-empty) {
git tag -a $tag_name -m $'Pre release from Nushell main branch'
git push origin --tags
}

0 comments on commit 898cfa2

Please sign in to comment.