Skip to content

Commit

Permalink
Add crontab support for pre-release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcer committed Oct 24, 2024
1 parent 898cfa2 commit 345d758
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,21 @@ jobs:
- name: Pre Release
shell: nu {0}
run: |
const MAX_COUNT = 12
const RELEASE_INTERVAL = 28
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)day' | into duration) | 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 }}
# 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
Expand All @@ -51,8 +66,9 @@ jobs:
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
}
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'

0 comments on commit 345d758

Please sign in to comment.