Skip to content

Pre Release

Pre Release #95

Workflow file for this run

name: Pre Release
on:
push:
branches:
- nightly0 # Just for test purpose only with the nightly repo
# 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.100.0
# Synchronize the main branch of nightly repo with the main branch of Nushell official repo
- name: Pre Release
shell: nu {0}
run: |
const MAX_COUNT = 12
const RELEASE_INTERVAL = 28day
const DATE_FORMAT = '%Y/%m/%d'
const START_DATE = '2024/10/15'
let releaseDays = 1..$MAX_COUNT | each {|it| ($START_DATE | into datetime) + ($RELEASE_INTERVAL * $it) | format date $DATE_FORMAT }
print $'Checking for the following release day:(char nl)'
$env.config.table.mode = 'psql'
$releaseDays | print
let force = '${{ github.event.inputs.force }}' == 'true'
# Do a pre release The day before offical release date
let shouldRelease = ((date now) + 1day | format date $DATE_FORMAT) in $releaseDays
if $force != true and (not $shouldRelease) {
print 'No need to pre release. Bye...'; exit 0
}
if $force { print 'Force run is enabled. Doing a pre release now ...' }
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 = $'($version)-pre'
if $tag in (git tag | lines) { git tag -d $tag }
git tag -a $tag -m $'Pre release from Nushell main branch'
git push origin $tag --force
print $'The tag (ansi p)($tag)(ansi reset) has been created and the release workflow has been triggered.'
print $'Please check it at https://github.com/nushell/nightly/actions/workflows/release.yml'