|
1 | 1 | name: Pre Release
|
2 | 2 |
|
3 | 3 | on:
|
| 4 | + push: |
| 5 | + branches: |
| 6 | + - nightly # Just for test purpose only with the nightly repo |
4 | 7 | # This schedule will run only from the default branch
|
5 | 8 | schedule:
|
6 | 9 | - cron: '30 1 * * *' # run at 00:15 AM UTC
|
|
39 | 42 | - name: Pre Release
|
40 | 43 | shell: nu {0}
|
41 | 44 | run: |
|
| 45 | + const MAX_COUNT = 12 |
| 46 | + const RELEASE_INTERVAL = 28 |
| 47 | + const DATE_FORMAT = '%Y/%m/%d' |
| 48 | + const START_DATE = '2024/10/15' |
| 49 | + let releaseDays = 1..$MAX_COUNT | each {|it| ($START_DATE | into datetime) + ($'($RELEASE_INTERVAL * $it)day' | into duration) | format date $DATE_FORMAT } |
| 50 | + print $'Checking for the following release day:(char nl)' |
| 51 | + $env.config.table.mode = 'psql' |
| 52 | + $releaseDays | print |
| 53 | + let force = '${{ github.event.inputs.force }}' == 'true' |
| 54 | + # Do a pre release The day before offical release date |
| 55 | + let shouldRelease = ((date now) + 1day | format date $DATE_FORMAT) in $releaseDays |
| 56 | + if $force != true and (not $shouldRelease) { |
| 57 | + print 'No need to pre release. Bye...'; exit 0 |
| 58 | + } |
| 59 | + if $force { print 'Force run is enabled. Doing a pre release now ...' } |
42 | 60 | cd $env.GITHUB_WORKSPACE
|
43 | 61 | git checkout main
|
44 | 62 | # We can't push if no user name and email are configured
|
|
51 | 69 | git reset --hard src/main
|
52 | 70 | git push origin main -f
|
53 | 71 | 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 |
| - } |
| 72 | + let tag = $'($version)-pre' |
| 73 | + if $tag in (git tag | lines) { git tag -d $tag } |
| 74 | + git tag -a $tag -m $'Pre release from Nushell main branch' |
| 75 | + git push origin $tag --force |
| 76 | + print $'The tag (ansi p)($tag)(ansi reset) has been created and the release workflow has been triggered.' |
| 77 | + print $'Please check it at https://github.com/nushell/nightly/actions/workflows/release.yml' |
0 commit comments