Synchronize code before the nightly build starts (#9430)

<!--
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
Synchronize code before the nightly build starts
This commit is contained in:
Justin Ma 2023-06-14 12:26:09 +08:00 committed by GitHub
parent 604aadc938
commit 30ccabde5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,11 +25,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with:
- name: Set Outputs of Short SHA ref: main
id: vars fetch-depth: 0
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT # Configure PAT here: https://github.com/settings/tokens for the push operation in the following steps
token: ${{ secrets.WORKFLOW_TOKEN }}
- name: Setup Nushell - name: Setup Nushell
uses: hustcer/setup-nu@v3 uses: hustcer/setup-nu@v3
@ -43,10 +44,16 @@ jobs:
run: | run: |
cd $env.GITHUB_WORKSPACE cd $env.GITHUB_WORKSPACE
git checkout main git checkout main
git config --global user.name 'hustcer' git config user.name 'hustcer'
git config --global user.email 'hustcer@outlook.com' git config user.email 'hustcer@outlook.com'
let tag_name = 'nightly-${{ steps.vars.outputs.sha_short }}' git fetch origin main
git fetch origin -p git remote add src https://github.com/nushell/nushell.git
git fetch src main
# git pull --rebase src main
git reset --hard src/main
git push origin main -f
let sha_short = (git rev-parse --short src/main | str trim)
let tag_name = $'nightly-($sha_short)'
if (git ls-remote --tags origin $tag_name | is-empty) { if (git ls-remote --tags origin $tag_name | is-empty) {
git tag -a $tag_name -m $'Nightly build from ($env.GITHUB_SHA)' git tag -a $tag_name -m $'Nightly build from ($env.GITHUB_SHA)'
git push origin --tags git push origin --tags
@ -73,7 +80,7 @@ jobs:
all: all:
name: All name: All
needs: prepare
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -131,6 +138,8 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with:
ref: main
- name: Update Rust Toolchain Target - name: Update Rust Toolchain Target
run: | run: |