build: correctly build pr to generate assets (#2051)

This commit is contained in:
Baptiste Augrain 2024-10-08 13:23:42 +02:00 committed by GitHub
parent 48cabed6ba
commit fc453f25f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 102 additions and 26 deletions

View File

@ -49,9 +49,12 @@ jobs:
with: with:
ref: ${{ env.GITHUB_BRANCH }} ref: ${{ env.GITHUB_BRANCH }}
- name: Clone VSCode repo - name: Switch to relevant branch
env: env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }} PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Clone VSCode repo
run: ./get_repo.sh run: ./get_repo.sh
- name: Check PR or cron - name: Check PR or cron
@ -84,6 +87,11 @@ jobs:
ref: ${{ env.GITHUB_BRANCH }} ref: ${{ env.GITHUB_BRANCH }}
if: env.SHOULD_BUILD == 'yes' if: env.SHOULD_BUILD == 'yes'
- name: Switch to relevant branch
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Setup Node.js environment - name: Setup Node.js environment
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
@ -105,8 +113,6 @@ jobs:
if: env.SHOULD_BUILD == 'yes' if: env.SHOULD_BUILD == 'yes'
- name: Clone VSCode repo - name: Clone VSCode repo
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_repo.sh run: ./get_repo.sh
if: env.SHOULD_BUILD == 'yes' if: env.SHOULD_BUILD == 'yes'
@ -175,6 +181,11 @@ jobs:
ref: ${{ env.GITHUB_BRANCH }} ref: ${{ env.GITHUB_BRANCH }}
if: env.SHOULD_BUILD == 'yes' if: env.SHOULD_BUILD == 'yes'
- name: Switch to relevant branch
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Install GH - name: Install GH
run: ./install_gh.sh run: ./install_gh.sh
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes' if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
@ -268,6 +279,11 @@ jobs:
with: with:
ref: ${{ env.GITHUB_BRANCH }} ref: ${{ env.GITHUB_BRANCH }}
- name: Switch to relevant branch
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Setup Node.js environment - name: Setup Node.js environment
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
@ -348,6 +364,11 @@ jobs:
with: with:
ref: ${{ env.GITHUB_BRANCH }} ref: ${{ env.GITHUB_BRANCH }}
- name: Switch to relevant branch
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Install GH - name: Install GH
run: ./install_gh.sh run: ./install_gh.sh
if: env.SHOULD_DEPLOY == 'yes' if: env.SHOULD_DEPLOY == 'yes'
@ -436,6 +457,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with:
ref: ${{ env.GITHUB_BRANCH }}
- name: Switch to relevant branch
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- uses: docker/setup-qemu-action@v3 - uses: docker/setup-qemu-action@v3

View File

@ -51,6 +51,11 @@ jobs:
with: with:
ref: ${{ env.GITHUB_BRANCH }} ref: ${{ env.GITHUB_BRANCH }}
- name: Switch to relevant branch
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Setup Node.js environment - name: Setup Node.js environment
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
@ -63,8 +68,6 @@ jobs:
if: env.VSCODE_ARCH == 'x64' if: env.VSCODE_ARCH == 'x64'
- name: Clone VSCode repo - name: Clone VSCode repo
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: . get_repo.sh run: . get_repo.sh
- name: Check PR or cron - name: Check PR or cron

View File

@ -55,6 +55,11 @@ jobs:
with: with:
ref: ${{ env.GITHUB_BRANCH }} ref: ${{ env.GITHUB_BRANCH }}
- name: Switch to relevant branch
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Setup Node.js environment - name: Setup Node.js environment
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
@ -69,8 +74,6 @@ jobs:
python-version: '3.11' python-version: '3.11'
- name: Clone VSCode repo - name: Clone VSCode repo
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_repo.sh run: ./get_repo.sh
- name: Check PR or cron - name: Check PR or cron

View File

@ -48,9 +48,12 @@ jobs:
with: with:
ref: ${{ env.GITHUB_BRANCH }} ref: ${{ env.GITHUB_BRANCH }}
- name: Clone VSCode repo - name: Switch to relevant branch
env: env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }} PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Clone VSCode repo
run: ./get_repo.sh run: ./get_repo.sh
- name: Check PR or cron - name: Check PR or cron
@ -83,6 +86,11 @@ jobs:
ref: ${{ env.GITHUB_BRANCH }} ref: ${{ env.GITHUB_BRANCH }}
if: env.SHOULD_BUILD == 'yes' if: env.SHOULD_BUILD == 'yes'
- name: Switch to relevant branch
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Setup Node.js environment - name: Setup Node.js environment
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
@ -104,8 +112,6 @@ jobs:
if: env.SHOULD_BUILD == 'yes' if: env.SHOULD_BUILD == 'yes'
- name: Clone VSCode repo - name: Clone VSCode repo
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_repo.sh run: ./get_repo.sh
if: env.SHOULD_BUILD == 'yes' if: env.SHOULD_BUILD == 'yes'
@ -174,6 +180,11 @@ jobs:
ref: ${{ env.GITHUB_BRANCH }} ref: ${{ env.GITHUB_BRANCH }}
if: env.SHOULD_BUILD == 'yes' if: env.SHOULD_BUILD == 'yes'
- name: Switch to relevant branch
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Install GH - name: Install GH
run: ./install_gh.sh run: ./install_gh.sh
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes' if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
@ -267,6 +278,11 @@ jobs:
with: with:
ref: ${{ env.GITHUB_BRANCH }} ref: ${{ env.GITHUB_BRANCH }}
- name: Switch to relevant branch
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Setup Node.js environment - name: Setup Node.js environment
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
@ -347,6 +363,11 @@ jobs:
with: with:
ref: ${{ env.GITHUB_BRANCH }} ref: ${{ env.GITHUB_BRANCH }}
- name: Switch to relevant branch
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Install GH - name: Install GH
run: ./install_gh.sh run: ./install_gh.sh
if: env.SHOULD_DEPLOY == 'yes' if: env.SHOULD_DEPLOY == 'yes'
@ -432,6 +453,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with:
ref: ${{ env.GITHUB_BRANCH }}
- name: Switch to relevant branch
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Check version - name: Check version
env: env:

View File

@ -47,6 +47,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
ref: ${{ env.GITHUB_BRANCH }}
- name: Switch to relevant branch
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Setup Node.js environment - name: Setup Node.js environment
uses: actions/setup-node@v4 uses: actions/setup-node@v4
@ -60,8 +67,6 @@ jobs:
if: env.VSCODE_ARCH == 'x64' if: env.VSCODE_ARCH == 'x64'
- name: Clone VSCode repo - name: Clone VSCode repo
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: . get_repo.sh run: . get_repo.sh
- name: Check PR or cron - name: Check PR or cron

View File

@ -52,6 +52,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
ref: ${{ env.GITHUB_BRANCH }}
- name: Switch to relevant branch
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_pr.sh
- name: Setup Node.js environment - name: Setup Node.js environment
uses: actions/setup-node@v4 uses: actions/setup-node@v4
@ -67,8 +74,6 @@ jobs:
python-version: '3.11' python-version: '3.11'
- name: Clone VSCode repo - name: Clone VSCode repo
env:
PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
run: ./get_repo.sh run: ./get_repo.sh
- name: Check PR or cron - name: Check PR or cron
@ -85,7 +90,6 @@ jobs:
- name: Build - name: Build
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ github.repository_owner }}
npm_config_arch: ${{ matrix.vscode_arch }} npm_config_arch: ${{ matrix.vscode_arch }}
npm_config_target_arch: ${{ matrix.vscode_arch }} npm_config_target_arch: ${{ matrix.vscode_arch }}
run: ./build.sh run: ./build.sh
@ -129,6 +133,8 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
ref: ${{ env.GITHUB_BRANCH }}
- name: Check version - name: Check version
run: ./stores/winget/check_version.sh run: ./stores/winget/check_version.sh

14
get_pr.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e
if [[ -n "${PULL_REQUEST_ID}" ]]; then
BRANCH_NAME=$( git rev-parse --abbrev-ref HEAD )
git config --global user.email "$( echo "${GITHUB_USERNAME}" | awk '{print tolower($0)}' )-ci@not-real.com"
git config --global user.name "${GITHUB_USERNAME} CI"
git fetch --unshallow
git fetch origin "pull/${PULL_REQUEST_ID}/head"
git checkout FETCH_HEAD
git merge --no-edit "origin/${BRANCH_NAME}"
fi

View File

@ -8,17 +8,6 @@ if [[ "${CI_BUILD}" != "no" ]]; then
git config --global --add safe.directory "/__w/$( echo "${GITHUB_REPOSITORY}" | awk '{print tolower($0)}' )" git config --global --add safe.directory "/__w/$( echo "${GITHUB_REPOSITORY}" | awk '{print tolower($0)}' )"
fi fi
if [[ -n "${PULL_REQUEST_ID}" ]]; then
BRANCH_NAME=$( git rev-parse --abbrev-ref HEAD )
git config --global user.email "$( echo "${GITHUB_USERNAME}" | awk '{print tolower($0)}' )-ci@not-real.com"
git config --global user.name "${GITHUB_USERNAME} CI"
git fetch --unshallow
git fetch origin "pull/${PULL_REQUEST_ID}/head"
git checkout FETCH_HEAD
git merge --no-edit "origin/${BRANCH_NAME}"
fi
if [[ -z "${RELEASE_VERSION}" ]]; then if [[ -z "${RELEASE_VERSION}" ]]; then
if [[ "${VSCODE_LATEST}" == "yes" ]] || [[ ! -f "${VSCODE_QUALITY}.json" ]]; then if [[ "${VSCODE_LATEST}" == "yes" ]] || [[ ! -f "${VSCODE_QUALITY}.json" ]]; then
echo "Retrieve lastest version" echo "Retrieve lastest version"