feat: selective publish (#858)

This commit is contained in:
Baptiste Augrain 2021-10-01 18:47:10 +02:00 committed by GitHub
parent 85cbd0b0f2
commit e564685c1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 523 additions and 326 deletions

22
.editorconfig Normal file
View File

@ -0,0 +1,22 @@
root = true
[*]
indent_style = space
indent_size = 2
tab_width = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.sh]
indent_style = space
indent_size = 2
[*.{yml,yaml}]
indent_style = space
indent_size = 2
[*.patch]
trim_trailing_whitespace = false
insert_final_newline = false

View File

@ -34,6 +34,9 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install GH
run: ./install_gh.sh
- name: Setup Node.js environment - name: Setup Node.js environment
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
@ -42,12 +45,12 @@ jobs:
- name: Install Yarn - name: Install Yarn
run: npm install -g yarn run: npm install -g yarn
- name: Check PR or cron
run: ./check_cron_or_pr.sh
- name: Clone VSCode repo - name: Clone VSCode repo
run: ./get_repo.sh run: ./get_repo.sh
- name: Check PR or cron
run: ./check_cron_or_pr.sh
- name: Check existing VSCodium tags/releases - name: Check existing VSCodium tags/releases
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -79,42 +82,15 @@ jobs:
run: ./build.sh run: ./build.sh
if: env.SHOULD_BUILD == 'yes' if: env.SHOULD_BUILD == 'yes'
- name: Zip release - name: Prepare artifacts
run: | run: ./prepare_artifacts.sh
cd VSCode-linux-${VSCODE_ARCH}
tar czf ../VSCodium-linux-${VSCODE_ARCH}-${MS_TAG}.tar.gz .
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
- name: Move/rename build artifacts
shell: bash
run: |
cp vscode/.build/linux/deb/*/deb/*.deb .
cp vscode/.build/linux/rpm/*/*.rpm .
if [[ "${VSCODE_ARCH}" == "x64" ]]; then
cp build/linux/appimage/out/*.AppImage* .
fi
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
- name: Generate shasums
run: ./sum.sh
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes' if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
- name: Release - name: Release
uses: softprops/action-gh-release@v1
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
with:
tag_name: ${{ env.MS_TAG }}
files: |
./*.sha256
./*.zip
./*.tar.gz
./*.deb
./*.rpm
./VSCodium-*.AppImage
./VSCodium-*.AppImage.zsync
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_CLI_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./release.sh
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
- name: Update versions repo - name: Update versions repo
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes' if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'

View File

@ -33,19 +33,16 @@ jobs:
with: with:
node-version: 14 node-version: 14
- name: Check PR or cron
run: |
. check_cron_or_pr.sh
- name: Clone VSCode repo - name: Clone VSCode repo
run: | run: . get_repo.sh
. get_repo.sh
- name: Check PR or cron
run: . check_cron_or_pr.sh
- name: Check existing VSCodium tags/releases - name: Check existing VSCodium tags/releases
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: . check_tags.sh
. check_tags.sh
if: env.SHOULD_DEPLOY == 'yes' if: env.SHOULD_DEPLOY == 'yes'
- name: Compute cache key - name: Compute cache key
@ -92,35 +89,15 @@ jobs:
codesign --deep --force --verbose --sign "$CERTIFICATE_OSX_ID" VSCodium.app codesign --deep --force --verbose --sign "$CERTIFICATE_OSX_ID" VSCodium.app
fi fi
- name: Zip release - name: Prepare artifacts
run: | run: ./prepare_artifacts.sh
cd "VSCode-darwin-${VSCODE_ARCH}"
zip -r -X -y ../VSCodium-darwin-${VSCODE_ARCH}-${MS_TAG}.zip ./*.app
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
- name: DMG the release
run: |
pushd "VSCode-darwin-${VSCODE_ARCH}"
npx create-dmg VSCodium.app ..
mv "../VSCodium ${MS_TAG}.dmg" "../VSCodium.${VSCODE_ARCH}.${MS_TAG}.dmg"
popd
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
- name: Generate shasums
run: ./sum.sh
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes' if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
- name: Release - name: Release
uses: softprops/action-gh-release@v1
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
with:
tag_name: ${{ env.MS_TAG }}
files: |
./*.zip
./*.dmg
./*.sha256
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_CLI_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./release.sh
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
- name: Update versions repo - name: Update versions repo
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes' if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'

View File

@ -11,6 +11,9 @@ on:
jobs: jobs:
windows: windows:
runs-on: windows-2016 runs-on: windows-2016
defaults:
run:
shell: bash
env: env:
VSCODE_ARCH: ${{ matrix.vscode_arch }} VSCODE_ARCH: ${{ matrix.vscode_arch }}
OS_NAME: 'windows' OS_NAME: 'windows'
@ -41,19 +44,16 @@ jobs:
with: with:
python-version: '2.x' python-version: '2.x'
- name: Check PR or cron
run: ./check_cron_or_pr.sh
shell: bash
- name: Clone VSCode repo - name: Clone VSCode repo
run: ./get_repo.sh run: ./get_repo.sh
shell: bash
- name: Check PR or cron
run: ./check_cron_or_pr.sh
- name: Check existing VSCodium tags/releases - name: Check existing VSCodium tags/releases
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./check_tags.sh run: ./check_tags.sh
shell: bash
if: env.SHOULD_DEPLOY == 'yes' if: env.SHOULD_DEPLOY == 'yes'
- name: Compute cache key - name: Compute cache key
@ -80,45 +80,21 @@ jobs:
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
shell: bash
if: env.SHOULD_BUILD == 'yes' if: env.SHOULD_BUILD == 'yes'
- name: Move/rename build artifacts - name: Prepare artifacts
run: | run: ./prepare_artifacts.sh
mv vscode\\.build\\win32-${VSCODE_ARCH}\\system-setup\\VSCodeSetup.exe VSCodiumSetup-${VSCODE_ARCH}-${MS_TAG}.exe
mv vscode\\.build\\win32-${VSCODE_ARCH}\\user-setup\\VSCodeSetup.exe VSCodiumUserSetup-${VSCODE_ARCH}-${MS_TAG}.exe
mv vscode\\.build\\win32-${VSCODE_ARCH}\\archive\\VSCode-win32-${VSCODE_ARCH}.zip VSCodium-win32-${VSCODE_ARCH}-${MS_TAG}.zip
if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then
mv build\\windows\\msi\\releasedir\\VSCodium-${VSCODE_ARCH}-${MS_TAG}.msi .
mv build\\windows\\msi\\releasedir\\VSCodium-${VSCODE_ARCH}-updates-disabled-${MS_TAG}.msi .
fi
shell: bash
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
- name: Generate shasums
run: ./sum.sh
shell: bash
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes' if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
- name: Release - name: Release
uses: softprops/action-gh-release@v1
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
with:
tag_name: ${{ env.MS_TAG }}
files: |
./*.sha256
./VSCodium*.zip
./VSCodiumUserSetup*.exe
./VSCodiumSetup*.exe
./VSCodium*.msi
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_CLI_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./release.sh
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
- name: Update versions repo - name: Update versions repo
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes' if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
run: ./update_version.sh run: ./update_version.sh
shell: bash
env: env:
GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ github.repository_owner }} GITHUB_USERNAME: ${{ github.repository_owner }}

View File

@ -2,7 +2,7 @@
set -ex set -ex
if [[ "$SHOULD_BUILD" == "yes" ]]; then if [[ "${SHOULD_BUILD}" == "yes" ]]; then
npm config set scripts-prepend-node-path true npm config set scripts-prepend-node-path true
echo "MS_COMMIT: ${MS_COMMIT}" echo "MS_COMMIT: ${MS_COMMIT}"
@ -19,31 +19,53 @@ if [[ "$SHOULD_BUILD" == "yes" ]]; then
yarn gulp compile-extensions-build yarn gulp compile-extensions-build
yarn gulp minify-vscode yarn gulp minify-vscode
if [[ "$OS_NAME" == "osx" ]]; then if [[ "${OS_NAME}" == "osx" ]]; then
yarn gulp "vscode-darwin-${VSCODE_ARCH}-min-ci" yarn gulp "vscode-darwin-${VSCODE_ARCH}-min-ci"
elif [[ "$OS_NAME" == "windows" ]]; then elif [[ "${OS_NAME}" == "windows" ]]; then
. ../build/windows/rtf/make.sh . ../build/windows/rtf/make.sh
yarn gulp "vscode-win32-${VSCODE_ARCH}-min-ci" yarn gulp "vscode-win32-${VSCODE_ARCH}-min-ci"
yarn gulp "vscode-win32-${VSCODE_ARCH}-code-helper" yarn gulp "vscode-win32-${VSCODE_ARCH}-code-helper"
yarn gulp "vscode-win32-${VSCODE_ARCH}-inno-updater" yarn gulp "vscode-win32-${VSCODE_ARCH}-inno-updater"
if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
yarn gulp "vscode-win32-${VSCODE_ARCH}-archive" yarn gulp "vscode-win32-${VSCODE_ARCH}-archive"
fi
if [[ "${SHOULD_BUILD_EXE_SYS}" != "no" ]]; then
yarn gulp "vscode-win32-${VSCODE_ARCH}-system-setup" yarn gulp "vscode-win32-${VSCODE_ARCH}-system-setup"
fi
if [[ "${SHOULD_BUILD_EXE_USR}" != "no" ]]; then
yarn gulp "vscode-win32-${VSCODE_ARCH}-user-setup" yarn gulp "vscode-win32-${VSCODE_ARCH}-user-setup"
fi
if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then
if [[ "${SHOULD_BUILD_MSI}" != "no" ]]; then
. ../build/windows/msi/build.sh . ../build/windows/msi/build.sh
fi
if [[ "${SHOULD_BUILD_MSI_NOUP}" != "no" ]]; then
. ../build/windows/msi/build-updates-disabled.sh . ../build/windows/msi/build-updates-disabled.sh
fi fi
fi
else # linux else # linux
yarn gulp "vscode-linux-${VSCODE_ARCH}-min-ci" yarn gulp "vscode-linux-${VSCODE_ARCH}-min-ci"
if [[ "$SKIP_LINUX_PACKAGES" != "True" ]]; then
yarn gulp "vscode-linux-${VSCODE_ARCH}-build-deb"
yarn gulp "vscode-linux-${VSCODE_ARCH}-build-rpm"
if [[ "${SKIP_LINUX_PACKAGES}" != "True" ]]; then
if [[ "${SHOULD_BUILD_DEB}" != "no" || "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then
yarn gulp "vscode-linux-${VSCODE_ARCH}-build-deb"
fi
if [[ "${SHOULD_BUILD_RPM}" != "no" ]]; then
yarn gulp "vscode-linux-${VSCODE_ARCH}-build-rpm"
fi
if [[ "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then
. ../build/linux/appimage/build.sh . ../build/linux/appimage/build.sh
fi fi
fi fi
fi
cd .. cd ..
fi fi

View File

@ -2,147 +2,259 @@
set -e set -e
if [[ -z "${GITHUB_TOKEN}" ]]; then
echo "Will not build because no GITHUB_TOKEN defined"
exit
fi
REPOSITORY="${GITHUB_REPOSITORY:-"VSCodium/vscodium"}" REPOSITORY="${GITHUB_REPOSITORY:-"VSCodium/vscodium"}"
GITHUB_RESPONSE=$( curl -s -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/$REPOSITORY/releases/tags/$MS_TAG) GITHUB_RESPONSE=$( curl -s -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/${REPOSITORY}/releases/tags/${MS_TAG})
VSCODIUM_ASSETS=$( echo $GITHUB_RESPONSE | jq -c '.assets | map(.name)?' ) VSCODIUM_ASSETS=$( echo "${GITHUB_RESPONSE}" | jq -c '.assets | map(.name)?' )
contains() { contains() {
# add " to match the end of a string so any hashs won't be matched by mistake # add " to match the end of a string so any hashs won't be matched by mistake
echo $VSCODIUM_ASSETS | grep "$1\"" echo "${VSCODIUM_ASSETS}" | grep "$1\""
} }
# if we just don't have the github token, get out fast if [ "${VSCODIUM_ASSETS}" != "null" ]; then
if [ "$GITHUB_TOKEN" != "" ]; then
if [ "$VSCODIUM_ASSETS" != "null" ]; then
# macos # macos
if [[ "$OS_NAME" == "osx" ]]; then if [[ "${OS_NAME}" == "osx" ]]; then
if [[ -z $( contains "darwin-$VSCODE_ARCH-$MS_TAG.zip" ) ]]; then if [[ -z $( contains "darwin-${VSCODE_ARCH}-${MS_TAG}.zip" ) ]]; then
echo "Building on Mac because we have no ZIP" echo "Building on MacOS because we have no ZIP"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_ZIP="no"
fi fi
elif [[ "$OS_NAME" == "windows" ]]; then
if [[ -z $( contains ".${VSCODE_ARCH}.${MS_TAG}.dmg" ) ]]; then
echo "Building on MacOS because we have no DMG"
export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_DMG="no"
fi
if [[ "${SHOULD_BUILD}" != "yes" ]]; then
echo "Already have all the MacOS builds"
fi
elif [[ "${OS_NAME}" == "windows" ]]; then
# windows-arm64 # windows-arm64
if [[ $VSCODE_ARCH == "arm64" ]]; then if [[ ${VSCODE_ARCH} == "arm64" ]]; then
if [[ -z $( contains "VSCodiumSetup-$VSCODE_ARCH-$MS_TAG.exe" ) ]]; then if [[ -z $( contains "VSCodiumSetup-${VSCODE_ARCH}-${MS_TAG}.exe" ) ]]; then
echo "Building on Windows arm64 because we have no system setup" echo "Building on Windows arm64 because we have no system setup"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_EXE_SYS="no"
fi fi
if [[ -z $( contains "UserSetup-$VSCODE_ARCH-$MS_TAG.exe" ) ]]; then
if [[ -z $( contains "UserSetup-${VSCODE_ARCH}-${MS_TAG}.exe" ) ]]; then
echo "Building on Windows arm64 because we have no user setup" echo "Building on Windows arm64 because we have no user setup"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_EXE_USR="no"
fi fi
if [[ -z $( contains "win32-$VSCODE_ARCH-$MS_TAG.zip" ) ]]; then
if [[ -z $( contains "win32-${VSCODE_ARCH}-${MS_TAG}.zip" ) ]]; then
echo "Building on Windows arm64 because we have no zip" echo "Building on Windows arm64 because we have no zip"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_ZIP="no"
fi fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
if [[ "${SHOULD_BUILD}" != "yes" ]]; then
echo "Already have all the Windows arm64 builds" echo "Already have all the Windows arm64 builds"
fi fi
# windows-ia32 # windows-ia32
elif [[ $VSCODE_ARCH == "ia32" ]]; then elif [[ ${VSCODE_ARCH} == "ia32" ]]; then
if [[ -z $( contains "VSCodiumSetup-$VSCODE_ARCH-$MS_TAG.exe" ) ]]; then if [[ -z $( contains "VSCodiumSetup-${VSCODE_ARCH}-${MS_TAG}.exe" ) ]]; then
echo "Building on Windows ia32 because we have no system setup" echo "Building on Windows ia32 because we have no system setup"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_EXE_SYS="no"
fi fi
if [[ -z $( contains "UserSetup-$VSCODE_ARCH-$MS_TAG.exe" ) ]]; then
if [[ -z $( contains "UserSetup-${VSCODE_ARCH}-${MS_TAG}.exe" ) ]]; then
echo "Building on Windows ia32 because we have no user setup" echo "Building on Windows ia32 because we have no user setup"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_EXE_USR="no"
fi fi
if [[ -z $( contains "win32-$VSCODE_ARCH-$MS_TAG.zip" ) ]]; then
if [[ -z $( contains "win32-${VSCODE_ARCH}-${MS_TAG}.zip" ) ]]; then
echo "Building on Windows ia32 because we have no zip" echo "Building on Windows ia32 because we have no zip"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_ZIP="no"
fi fi
if [[ -z $( contains "VSCodium-$VSCODE_ARCH-$MS_TAG.msi" ) ]]; then
if [[ -z $( contains "VSCodium-${VSCODE_ARCH}-${MS_TAG}.msi" ) ]]; then
echo "Building on Windows ia32 because we have no msi" echo "Building on Windows ia32 because we have no msi"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_MSI="no"
fi fi
if [[ -z $( contains "VSCodium-$VSCODE_ARCH-updates-disabled-$MS_TAG.msi" ) ]]; then
if [[ -z $( contains "VSCodium-${VSCODE_ARCH}-updates-disabled-${MS_TAG}.msi" ) ]]; then
echo "Building on Windows ia32 because we have no updates-disabled msi" echo "Building on Windows ia32 because we have no updates-disabled msi"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_MSI_NOUP="no"
fi fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
if [[ "${SHOULD_BUILD}" != "yes" ]]; then
echo "Already have all the Windows ia32 builds" echo "Already have all the Windows ia32 builds"
fi fi
# windows-x64 # windows-x64
else else
if [[ -z $( contains "VSCodiumSetup-$VSCODE_ARCH-$MS_TAG.exe" ) ]]; then if [[ -z $( contains "VSCodiumSetup-${VSCODE_ARCH}-${MS_TAG}.exe" ) ]]; then
echo "Building on Windows x64 because we have no system setup" echo "Building on Windows x64 because we have no system setup"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_EXE_SYS="no"
fi fi
if [[ -z $( contains "UserSetup-$VSCODE_ARCH-$MS_TAG.exe" ) ]]; then
if [[ -z $( contains "UserSetup-${VSCODE_ARCH}-${MS_TAG}.exe" ) ]]; then
echo "Building on Windows x64 because we have no user setup" echo "Building on Windows x64 because we have no user setup"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_EXE_USR="no"
fi fi
if [[ -z $( contains "win32-$VSCODE_ARCH-$MS_TAG.zip" ) ]]; then
if [[ -z $( contains "win32-${VSCODE_ARCH}-${MS_TAG}.zip" ) ]]; then
echo "Building on Windows x64 because we have no zip" echo "Building on Windows x64 because we have no zip"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_ZIP="no"
fi fi
if [[ -z $( contains "VSCodium-$VSCODE_ARCH-$MS_TAG.msi" ) ]]; then
if [[ -z $( contains "VSCodium-${VSCODE_ARCH}-${MS_TAG}.msi" ) ]]; then
echo "Building on Windows x64 because we have no msi" echo "Building on Windows x64 because we have no msi"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_MSI="no"
fi fi
if [[ -z $( contains "VSCodium-$VSCODE_ARCH-updates-disabled-$MS_TAG.msi" ) ]]; then
if [[ -z $( contains "VSCodium-${VSCODE_ARCH}-updates-disabled-${MS_TAG}.msi" ) ]]; then
echo "Building on Windows x64 because we have no updates-disabled msi" echo "Building on Windows x64 because we have no updates-disabled msi"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_MSI_NOUP="no"
fi fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
if [[ "${SHOULD_BUILD}" != "yes" ]]; then
echo "Already have all the Windows x64 builds" echo "Already have all the Windows x64 builds"
fi fi
fi fi
elif [[ "$OS_NAME" == "linux" ]]; then elif [[ "${OS_NAME}" == "linux" ]]; then
# linux-arm64 # linux-arm64
if [[ $VSCODE_ARCH == "arm64" ]]; then if [[ ${VSCODE_ARCH} == "arm64" ]]; then
if [[ -z $( contains "arm64.deb" ) ]]; then if [[ -z $( contains "arm64.deb" ) ]]; then
echo "Building on Linux arm64 because we have no DEB" echo "Building on Linux arm64 because we have no DEB"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_DEB="no"
fi fi
if [[ -z $( contains "arm64-$MS_TAG.tar.gz" ) ]]; then
if [[ -z $( contains "aarch64.rpm" ) ]]; then
echo "Building on Linux arm64 because we have no RPM"
export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_RPM="no"
fi
if [[ -z $( contains "arm64-${MS_TAG}.tar.gz" ) ]]; then
echo "Building on Linux arm64 because we have no TAR" echo "Building on Linux arm64 because we have no TAR"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_TAR="no"
fi fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
export SHOULD_BUILD_APPIMAGE="no"
if [[ "${SHOULD_BUILD}" != "yes" ]]; then
echo "Already have all the Linux arm64 builds" echo "Already have all the Linux arm64 builds"
fi fi
# linux-armhf # linux-armhf
elif [[ $VSCODE_ARCH == "armhf" ]]; then elif [[ ${VSCODE_ARCH} == "armhf" ]]; then
if [[ -z $( contains "armhf.deb" ) ]]; then if [[ -z $( contains "armhf.deb" ) ]]; then
echo "Building on Linux arm because we have no DEB" echo "Building on Linux arm because we have no DEB"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_DEB="no"
fi fi
if [[ -z $( contains "armhf.rpm" ) ]]; then
echo "Building on Linux arm because we have no RPM"
export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_RPM="no"
fi
if [[ -z $( contains "armhf-${MS_TAG}.tar.gz" ) ]]; then if [[ -z $( contains "armhf-${MS_TAG}.tar.gz" ) ]]; then
echo "Building on Linux arm because we have no TAR" echo "Building on Linux arm because we have no TAR"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_TAR="no"
fi fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
export SHOULD_BUILD_APPIMAGE="no"
if [[ "${SHOULD_BUILD}" != "yes" ]]; then
echo "Already have all the Linux arm builds" echo "Already have all the Linux arm builds"
fi fi
# linux-x64 # linux-x64
else else
if [[ -z $( contains "x86_64.rpm" ) ]]; then
echo "Building on Linux x64 because we have no RPM"
export SHOULD_BUILD="yes"
fi
if [[ -z $( contains "amd64.deb" ) ]]; then if [[ -z $( contains "amd64.deb" ) ]]; then
echo "Building on Linux x64 because we have no DEB" echo "Building on Linux x64 because we have no DEB"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_DEB="no"
fi fi
if [[ -z $( contains "x64-$MS_TAG.tar.gz" ) ]]; then
if [[ -z $( contains "x86_64.rpm" ) ]]; then
echo "Building on Linux x64 because we have no RPM"
export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_RPM="no"
fi
if [[ -z $( contains "x64-${MS_TAG}.tar.gz" ) ]]; then
echo "Building on Linux x64 because we have no TAR" echo "Building on Linux x64 because we have no TAR"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_TAR="no"
fi fi
if [[ -z $( contains "x86_64.AppImage" ) ]]; then if [[ -z $( contains "x86_64.AppImage" ) ]]; then
echo "Building on Linux x64 because we have no AppImage" echo "Building on Linux x64 because we have no AppImage"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_APPIMAGE="no"
fi fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
if [[ "${SHOULD_BUILD}" != "yes" ]]; then
echo "Already have all the Linux x64 builds" echo "Already have all the Linux x64 builds"
fi fi
fi fi
fi fi
else else
echo "Release assets do not exist at all, continuing build" echo "Release assets do not exist at all, continuing build"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
fi
fi fi
echo "SHOULD_BUILD=$SHOULD_BUILD" >> $GITHUB_ENV echo "SHOULD_BUILD=${SHOULD_BUILD}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_APPIMAGE=${SHOULD_BUILD_APPIMAGE}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_DEB=${SHOULD_BUILD_DEB}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_DMG=${SHOULD_BUILD_DMG}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_EXE_SYS=${SHOULD_BUILD_EXE_SYS}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_EXE_USR=${SHOULD_BUILD_EXE_USR}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_MSI=${SHOULD_BUILD_MSI}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_MSI_NOUP=${SHOULD_BUILD_MSI_NOUP}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_RPM=${SHOULD_BUILD_RPM}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_TAR=${SHOULD_BUILD_TAR}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_ZIP=${SHOULD_BUILD_ZIP}" >> "${GITHUB_ENV}"

15
install_gh.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
set -e
GH_ARCH="amd64"
VERSION=`curl "https://api.github.com/repos/cli/cli/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' | cut -c2-`
curl -sSL "https://github.com/cli/cli/releases/download/v${VERSION}/gh_${VERSION}_linux_${GH_ARCH}.tar.gz" -o "gh_${VERSION}_linux_${GH_ARCH}.tar.gz"
tar xf "gh_${VERSION}_linux_${GH_ARCH}.tar.gz"
cp "gh_${VERSION}_linux_${GH_ARCH}/bin/gh" /usr/local/bin/
gh --version

92
prepare_artifacts.sh Executable file
View File

@ -0,0 +1,92 @@
#!/bin/bash
set -e
npm install -g checksum
sum_file() {
if [[ -f "$1" ]]; then
echo "Calcuating checksum for $1"
checksum -a sha256 "$1" > "$1".sha256
checksum "$1" > "$1".sha1
fi
}
mkdir artifacts
if [[ "${OS_NAME}" == "osx" ]]; then
if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
echo "Building and moving ZIP"
cd "VSCode-darwin-${VSCODE_ARCH}"
zip -r -X -y ../artifacts/VSCodium-darwin-${VSCODE_ARCH}-${MS_TAG}.zip ./*.app
cd ..
fi
if [[ "${SHOULD_BUILD_DMG}" != "no" ]]; then
echo "Building and moving DMG"
pushd "VSCode-darwin-${VSCODE_ARCH}"
npx create-dmg VSCodium.app ..
mv "../VSCodium ${MS_TAG}.dmg" "../artifacts/VSCodium.${VSCODE_ARCH}.${MS_TAG}.dmg"
popd
fi
elif [[ "${OS_NAME}" == "windows" ]]; then
if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
echo "Moving ZIP"
mv vscode\\.build\\win32-${VSCODE_ARCH}\\archive\\VSCode-win32-${VSCODE_ARCH}.zip artifacts\\VSCodium-win32-${VSCODE_ARCH}-${MS_TAG}.zip
fi
if [[ "${SHOULD_BUILD_EXE_SYS}" != "no" ]]; then
echo "Moving System EXE"
mv vscode\\.build\\win32-${VSCODE_ARCH}\\system-setup\\VSCodeSetup.exe artifacts\\VSCodiumSetup-${VSCODE_ARCH}-${MS_TAG}.exe
fi
if [[ "${SHOULD_BUILD_EXE_USR}" != "no" ]]; then
echo "Moving User EXE"
mv vscode\\.build\\win32-${VSCODE_ARCH}\\user-setup\\VSCodeSetup.exe artifacts\\VSCodiumUserSetup-${VSCODE_ARCH}-${MS_TAG}.exe
fi
if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then
if [[ "${SHOULD_BUILD_MSI}" != "no" ]]; then
echo "Moving MSI"
mv build\\windows\\msi\\releasedir\\VSCodium-${VSCODE_ARCH}-${MS_TAG}.msi artifacts/
fi
if [[ "${SHOULD_BUILD_MSI_NOUP}" != "no" ]]; then
echo "Moving MSI with disabled updates"
mv build\\windows\\msi\\releasedir\\VSCodium-${VSCODE_ARCH}-updates-disabled-${MS_TAG}.msi artifacts/
fi
fi
else
if [[ "${SHOULD_BUILD_TAR}" != "no" ]]; then
echo "Building and moving TAR"
cd VSCode-linux-${VSCODE_ARCH}
tar czf ../artifacts/VSCodium-linux-${VSCODE_ARCH}-${MS_TAG}.tar.gz .
cd ..
fi
if [[ "${SHOULD_BUILD_DEB}" != "no" ]]; then
echo "Moving DEB"
mv vscode/.build/linux/deb/*/deb/*.deb artifacts/
fi
if [[ "${SHOULD_BUILD_RPM}" != "no" ]]; then
echo "Moving RPM"
mv vscode/.build/linux/rpm/*/*.rpm artifacts/
fi
if [[ "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then
echo "Moving AppImage"
mv build/linux/appimage/out/*.AppImage* artifacts/
fi
fi
cd artifacts
for FILE in *
do
if [[ -f "${FILE}" ]]; then
sum_file "${FILE}"
fi
done
cd ..

27
release.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
set -e
if [[ -z "${GH_CLI_TOKEN}" ]]; then
echo "Will not release because no GH_CLI_TOKEN defined"
exit
fi
echo "${GH_CLI_TOKEN}" | gh auth login --with-token
if [[ $( gh release view "${MS_TAG}" 2>&1 ) =~ "release not found" ]]; then
echo "Creating release '${MS_TAG}'"
gh release create "${MS_TAG}"
fi
cd artifacts
for FILE in *
do
if [[ -f "${FILE}" ]] && [[ "${FILE}" != *.sha1 ]] && [[ "${FILE}" != *.sha256 ]]; then
echo "Uploading '${FILE}'"
gh release upload "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256"
fi
done
cd ..

28
sum.sh
View File

@ -1,28 +0,0 @@
#!/bin/bash
npm install -g checksum
sum_file () {
if [[ -f "$1" ]]; then
checksum -a sha256 "$1" > "$1".sha256
checksum "$1" > "$1".sha1
fi
}
if [[ "$SHOULD_BUILD" == "yes" ]]; then
if [[ "$OS_NAME" == "osx" ]]; then
sum_file VSCodium-darwin-*.zip
sum_file VSCodium*.dmg
elif [[ "$OS_NAME" == "windows" ]]; then
sum_file VSCodiumSetup-*.exe
sum_file VSCodiumUserSetup-*.exe
sum_file VSCodium-win32-*.zip
sum_file "VSCodium-${VSCODE_ARCH}-${MS_TAG}.msi"
sum_file "VSCodium-${VSCODE_ARCH}-updates-disabled-${MS_TAG}.msi"
else # linux
sum_file VSCodium-*.AppImage
sum_file VSCodium-linux*.tar.gz
sum_file *.deb
sum_file *.rpm
fi
fi

View File

@ -1,10 +1,17 @@
#!/bin/bash #!/bin/bash
if [[ "$SHOULD_BUILD" != "yes" ]]; then set -e
if [[ "${SHOULD_BUILD}" != "yes" ]]; then
echo "Will not update version JSON because we did not build" echo "Will not update version JSON because we did not build"
exit exit
fi fi
if [[ -z "${GITHUB_TOKEN}" ]]; then
echo "Will not update version JSON because no GITHUB_TOKEN defined"
exit
fi
# { # {
# "url": "https://az764295.vo.msecnd.net/stable/51b0b28134d51361cf996d2f0a1c698247aeabd8/VSCode-darwin-stable.zip", # "url": "https://az764295.vo.msecnd.net/stable/51b0b28134d51361cf996d2f0a1c698247aeabd8/VSCode-darwin-stable.zip",
# "name": "1.33.1", # "name": "1.33.1",
@ -24,37 +31,40 @@ fi
# `timestamp` is $(node -e 'console.log(Date.now())') # `timestamp` is $(node -e 'console.log(Date.now())')
# `sha256hash` in <filename>.sha256 # `sha256hash` in <filename>.sha256
URL_BASE=https://github.com/VSCodium/vscodium/releases/download/${MS_TAG} URL_BASE="https://github.com/VSCodium/vscodium/releases/download/${MS_TAG}"
# to make testing on forks easier # to make testing on forks easier
VERSIONS_REPO="${GITHUB_USERNAME}/versions" VERSIONS_REPO="${GITHUB_USERNAME}/versions"
echo "Versions repo:" $VERSIONS_REPO echo "Versions repo: ${VERSIONS_REPO}"
# generateJson <assetName>
# e.g. generateJson VSCodium-darwin-1.33.0.zip
generateJson() { generateJson() {
local assetName=$1 JSON_DATA="{}"
# generate parts # generate parts
local url=${URL_BASE}/${assetName} local url="${URL_BASE}/${ASSET_NAME}"
local name=$MS_TAG local name="${MS_TAG}"
local version=$MS_COMMIT local version="${MS_COMMIT}"
local productVersion=$MS_TAG local productVersion="${MS_TAG}"
local timestamp=$(node -e 'console.log(Date.now())') local timestamp=$(node -e 'console.log(Date.now())')
local sha1hash=$(cat ${assetName}.sha1 | awk '{ print $1 }') if [[ ! -f "artifacts/${ASSET_NAME}" ]]; then
local sha256hash=$(cat ${assetName}.sha256 | awk '{ print $1 }') echo "Downloading artifact '${ASSET_NAME}'"
gh release download "${MS_TAG}" --dir "artifacts" --pattern "${ASSET_NAME}*"
fi
local sha1hash=$(cat "artifacts/${ASSET_NAME}.sha1" | awk '{ print $1 }')
local sha256hash=$(cat "artifacts/${ASSET_NAME}.sha256" | awk '{ print $1 }')
# check that nothing is blank (blank indicates something awry with build) # check that nothing is blank (blank indicates something awry with build)
for key in url name version productVersion sha1hash timestamp sha256hash; do for key in url name version productVersion sha1hash timestamp sha256hash; do
if [[ "${!key}" == "" ]]; then if [[ -z "${key}" ]]; then
echo "Missing data for version update; exiting..." echo "Variable '${key}' is empty; exiting..."
exit 1 exit 1
fi fi
done done
# generate json # generate json
local json=$(jq \ JSON_DATA=$(jq \
--arg url "${url}" \ --arg url "${url}" \
--arg name "${name}" \ --arg name "${name}" \
--arg version "${version}" \ --arg version "${version}" \
@ -64,70 +74,62 @@ generateJson() {
--arg sha256hash "${sha256hash}" \ --arg sha256hash "${sha256hash}" \
'. | .url=$url | .name=$name | .version=$version | .productVersion=$productVersion | .hash=$hash | .timestamp=$timestamp | .sha256hash=$sha256hash' \ '. | .url=$url | .name=$name | .version=$version | .productVersion=$productVersion | .hash=$hash | .timestamp=$timestamp | .sha256hash=$sha256hash' \
<<<'{}') <<<'{}')
echo "$json"
} }
updateLatestVersion() { updateLatestVersion() {
echo "Generating ${VERSION_PATH}/latest.json"
generateJson
cd versions cd versions
local versionPath=$1
local json=$2
# create/update the latest.json file in the correct location # create/update the latest.json file in the correct location
mkdir -p $versionPath mkdir -p "${VERSION_PATH}"
echo $json > $versionPath/latest.json echo "${JSON_DATA}" > "${VERSION_PATH}/latest.json"
cd .. cd ..
} }
# init versions repo for later commiting + pushing the json file to it # init versions repo for later commiting + pushing the json file to it
# thank you https://www.vinaygopinath.me/blog/tech/commit-to-master-branch-on-github-using-travis-ci/ # thank you https://www.vinaygopinath.me/blog/tech/commit-to-master-branch-on-github-using-travis-ci/
git clone https://github.com/${VERSIONS_REPO}.git git clone "https://github.com/${VERSIONS_REPO}.git"
cd versions cd versions
git config user.email "vscodium-ci@not-real.com" git config user.email "vscodium-ci@not-real.com"
git config user.name "VSCodium CI" git config user.name "VSCodium CI"
git remote rm origin git remote rm origin
git remote add origin https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${VERSIONS_REPO}.git > /dev/null 2>&1 git remote add origin "https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${VERSIONS_REPO}.git" > /dev/null 2>&1
cd .. cd ..
if [[ "$OS_NAME" == "osx" ]]; then if [[ "${OS_NAME}" == "osx" ]]; then
# zip, sha1, and sha256 files are all at top level dir
ASSET_NAME=VSCodium-darwin-${VSCODE_ARCH}-${MS_TAG}.zip ASSET_NAME=VSCodium-darwin-${VSCODE_ARCH}-${MS_TAG}.zip
VERSION_PATH="darwin/${VSCODE_ARCH}" VERSION_PATH="darwin/${VSCODE_ARCH}"
JSON="$(generateJson ${ASSET_NAME})" updateLatestVersion
updateLatestVersion "$VERSION_PATH" "$JSON" elif [[ "${OS_NAME}" == "windows" ]]; then
elif [[ "$OS_NAME" == "windows" ]]; then
# system installer # system installer
ASSET_NAME=VSCodiumSetup-${VSCODE_ARCH}-${MS_TAG}.exe ASSET_NAME=VSCodiumSetup-${VSCODE_ARCH}-${MS_TAG}.exe
VERSION_PATH="win32/${VSCODE_ARCH}/system" VERSION_PATH="win32/${VSCODE_ARCH}/system"
JSON="$(generateJson ${ASSET_NAME})" updateLatestVersion
updateLatestVersion "$VERSION_PATH" "$JSON"
# user installer # user installer
ASSET_NAME=VSCodiumUserSetup-${VSCODE_ARCH}-${MS_TAG}.exe ASSET_NAME=VSCodiumUserSetup-${VSCODE_ARCH}-${MS_TAG}.exe
VERSION_PATH="win32/${VSCODE_ARCH}/user" VERSION_PATH="win32/${VSCODE_ARCH}/user"
JSON="$(generateJson ${ASSET_NAME})" updateLatestVersion
updateLatestVersion "$VERSION_PATH" "$JSON"
# windows archive # windows archive
ASSET_NAME=VSCodium-win32-${VSCODE_ARCH}-${MS_TAG}.zip ASSET_NAME=VSCodium-win32-${VSCODE_ARCH}-${MS_TAG}.zip
VERSION_PATH="win32/${VSCODE_ARCH}/archive" VERSION_PATH="win32/${VSCODE_ARCH}/archive"
JSON="$(generateJson ${ASSET_NAME})" updateLatestVersion
updateLatestVersion "$VERSION_PATH" "$JSON"
if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then
# msi # msi
ASSET_NAME=VSCodium-${VSCODE_ARCH}-${MS_TAG}.msi ASSET_NAME=VSCodium-${VSCODE_ARCH}-${MS_TAG}.msi
VERSION_PATH="win32/${VSCODE_ARCH}/msi" VERSION_PATH="win32/${VSCODE_ARCH}/msi"
JSON="$(generateJson ${ASSET_NAME})" updateLatestVersion
updateLatestVersion "$VERSION_PATH" "$JSON"
# updates-disabled msi # updates-disabled msi
ASSET_NAME=VSCodium-${VSCODE_ARCH}-updates-disabled-${MS_TAG}.msi ASSET_NAME=VSCodium-${VSCODE_ARCH}-updates-disabled-${MS_TAG}.msi
VERSION_PATH="win32/${VSCODE_ARCH}/msi-updates-disabled" VERSION_PATH="win32/${VSCODE_ARCH}/msi-updates-disabled"
JSON="$(generateJson ${ASSET_NAME})" updateLatestVersion
updateLatestVersion "$VERSION_PATH" "$JSON"
fi fi
else # linux else # linux
# update service links to tar.gz file # update service links to tar.gz file
@ -135,19 +137,23 @@ else # linux
# as examples # as examples
ASSET_NAME=VSCodium-linux-${VSCODE_ARCH}-${MS_TAG}.tar.gz ASSET_NAME=VSCodium-linux-${VSCODE_ARCH}-${MS_TAG}.tar.gz
VERSION_PATH="linux/${VSCODE_ARCH}" VERSION_PATH="linux/${VSCODE_ARCH}"
JSON="$(generateJson ${ASSET_NAME})" updateLatestVersion
updateLatestVersion "$VERSION_PATH" "$JSON"
fi fi
cd versions cd versions
git pull origin master # in case another build just pushed git pull origin master # in case another build just pushed
git add . git add .
dateAndMonth=`date "+%D %T"`
git commit -m "CI update: $dateAndMonth (Build $GITHUB_RUN_NUMBER)" CHANGES=$( git status --porcelain )
if ! git push origin master --quiet; then
if [[ ! -z "${CHANGES}" ]]; then
dateAndMonth=$( date "+%D %T" )
git commit -m "CI update: ${dateAndMonth} (Build ${GITHUB_RUN_NUMBER})"
if ! git push origin master --quiet; then
git pull origin master git pull origin master
git push origin master --quiet git push origin master --quiet
fi
fi fi
cd .. cd ..