You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: .github/workflows/pre-release.yml
+21-5
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,21 @@ jobs:
39
39
- name: Pre Release
40
40
shell: nu {0}
41
41
run: |
42
+
const MAX_COUNT = 12
43
+
const RELEASE_INTERVAL = 28
44
+
const DATE_FORMAT = '%Y/%m/%d'
45
+
const START_DATE = '2024/10/15'
46
+
let releaseDays = 1..$MAX_COUNT | each {|it| ($START_DATE | into datetime) + ($'($RELEASE_INTERVAL * $it)day' | into duration) | format date $DATE_FORMAT }
47
+
print $'Checking for the following release day:(char nl)'
48
+
$env.config.table.mode = 'psql'
49
+
$releaseDays | print
50
+
let force = ${{ github.event.inputs.force }}
51
+
# Do a pre release The day before offical release date
52
+
let shouldRelease = ((date now) + 1day | format date $DATE_FORMAT) in $releaseDays
53
+
if $force != true and (not $shouldRelease) {
54
+
print 'No need to pre release. Bye...'; exit 0
55
+
}
56
+
if $force { print 'Force run is enabled. Doing a pre release now ...' }
42
57
cd $env.GITHUB_WORKSPACE
43
58
git checkout main
44
59
# We can't push if no user name and email are configured
@@ -51,8 +66,9 @@ jobs:
51
66
git reset --hard src/main
52
67
git push origin main -f
53
68
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
-
}
69
+
let tag = $'($version)-pre'
70
+
if $tag in (git tag | lines) { git tag -d $tag }
71
+
git tag -a $tag -m $'Pre release from Nushell main branch'
72
+
git push origin $tag --force
73
+
print $'The tag (ansi p)($tag)(ansi reset) has been created and the release workflow has been triggered.'
74
+
print $'Please check it at https://github.com/nushell/nightly/actions/workflows/release.yml'
0 commit comments