Change the nightly build schedule make it start by 9:15 BeiJing Time (#9442)

<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx

you can also mention related issues, PRs or discussions!
-->

# Description

Change the nightly build schedule make it start by 9:15 BeiJing Time or
01:15 UTC time
Tweak cleanup a bit
This commit is contained in:
Justin Ma 2023-06-15 14:37:08 +08:00 committed by GitHub
parent 33ad2a36bd
commit a94b3212a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,11 +8,12 @@
name: Nightly Build name: Nightly Build
on: on:
# push: push:
# branches: branches:
# - main - nightly # Just for test purpose only with the nightly repo
# This schedule will run only from the default branch
schedule: schedule:
- cron: '15 3 * * *' # run at 3:15 AM UTC - cron: '15 1 * * *' # run at 01:15 AM UTC
defaults: defaults:
run: run:
@ -22,6 +23,8 @@ jobs:
prepare: prepare:
name: Prepare name: Prepare
runs-on: ubuntu-latest runs-on: ubuntu-latest
# This job is required by the release job, so we should make it run both from Nushell repo and nightly repo
# if: github.repository == 'nushell/nightly'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -40,18 +43,21 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Synchronize the main branch of nightly repo with the main branch of Nushell official repo
- name: Prepare for Nightly Release - name: Prepare for Nightly Release
shell: nu {0} shell: nu {0}
if: github.repository == 'nushell/nightly' if: github.repository == 'nushell/nightly'
run: | run: |
cd $env.GITHUB_WORKSPACE cd $env.GITHUB_WORKSPACE
git checkout main git checkout main
# We can't push if no user name and email are configured
git config user.name 'hustcer' git config user.name 'hustcer'
git config user.email 'hustcer@outlook.com' git config user.email 'hustcer@outlook.com'
git fetch origin main git fetch origin main
git remote add src https://github.com/nushell/nushell.git git remote add src https://github.com/nushell/nushell.git
git fetch src main git fetch src main
# git pull --rebase src main # git pull --rebase src main
# All the changes will be overwritten by the upstream main branch
git reset --hard src/main git reset --hard src/main
git push origin main -f git push origin main -f
let sha_short = (git rev-parse --short src/main | str trim | str substring 0..7) let sha_short = (git rev-parse --short src/main | str trim | str substring 0..7)
@ -176,14 +182,15 @@ jobs:
name: Nu-nightly-${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }} name: Nu-nightly-${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }}
tag_name: nightly-${{ steps.vars.outputs.sha_short }} tag_name: nightly-${{ steps.vars.outputs.sha_short }}
body: | body: |
This is a nightly build of Nushell. This is a NIGHTLY build of Nushell.
It is not recommended for production use. It is NOT recommended for production use.
files: ${{ steps.nu.outputs.archive }} files: ${{ steps.nu.outputs.archive }}
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cleanup: cleanup:
name: Cleanup name: Cleanup
# Should only run in nushell/nightly repo
if: github.repository == 'nushell/nightly' if: github.repository == 'nushell/nightly'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -191,6 +198,10 @@ jobs:
- name: Waiting for Release - name: Waiting for Release
run: sleep 1800 run: sleep 1800
- uses: actions/checkout@v3
with:
ref: main
- name: Setup Nushell - name: Setup Nushell
uses: hustcer/setup-nu@v3 uses: hustcer/setup-nu@v3
with: with:
@ -199,7 +210,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Keep the last a few releases # Keep the last a few releases
# Should only run in nushell/nightly repo
- name: Delete Older Releases - name: Delete Older Releases
shell: nu {0} shell: nu {0}
run: | run: |