Skip to content

Commit

Permalink
Merge branch 'insider' of github.com:VSCodium/vscodium into insider
Browse files Browse the repository at this point in the history
  • Loading branch information
daiyam committed Feb 8, 2024
2 parents 96f5336 + b4589d9 commit 10f9067
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 100 deletions.
49 changes: 30 additions & 19 deletions .github/workflows/insider-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,14 @@ jobs:
- build
runs-on: ubuntu-latest
env:
APP_NAME: codium
RELEASE_VERSION: ${{ needs.build.outputs.RELEASE_VERSION }}
strategy:
fail-fast: false
matrix:
platform:
- amd64
- arm64
# if: needs.build.outputs.SHOULD_DEPLOY == 'yes'
if: false
if: needs.build.outputs.SHOULD_DEPLOY == 'yes'

steps:
- uses: actions/checkout@v3
Expand All @@ -237,25 +236,37 @@ jobs:
run: ./stores/snapcraft/check_version.sh

- uses: docker/setup-qemu-action@v3
if: env.SHOULD_DEPLOY == 'yes'
if: env.SHOULD_BUILD == 'yes'

- name: Prepare snapcraft.yaml
env:
ARCHITECTURE: ${{ matrix.platform }}
run: ./stores/snapcraft/build.sh
if: env.SHOULD_BUILD == 'yes'

# - uses: diddlesnaps/snapcraft-multiarch-action@v1
# with:
# path: stores/snapcraft/out
# architecture: ${{ matrix.platform }}
# id: build
# if: env.SHOULD_BUILD == 'yes'

- uses: diddlesnaps/snapcraft-multiarch-action@v1
- uses: snapcore/action-build@v1
with:
path: stores/snapcraft/insider
architecture: ${{ matrix.platform }}
path: stores/snapcraft/out
id: build
if: env.SHOULD_DEPLOY == 'yes'
if: env.SHOULD_BUILD == 'yes'

- uses: diddlesnaps/snapcraft-review-action@v1
with:
snap: ${{ steps.build.outputs.snap }}
isClassic: 'true'
if: env.SHOULD_DEPLOY == 'yes'
# - uses: diddlesnaps/snapcraft-review-action@v1
# with:
# snap: ${{ steps.build.outputs.snap }}
# isClassic: 'true'
# if: env.SHOULD_BUILD == 'yes'

- uses: snapcore/action-publish@master
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }}
- uses: svenstaro/upload-release-action@v2
with:
snap: ${{ steps.build.outputs.snap }}
release: edge
if: env.SHOULD_DEPLOY == 'yes'
repo_name: ${{ env.ASSETS_REPOSITORY }}
repo_token: ${{ secrets.STRONGER_GITHUB_TOKEN }}
file: ${{ steps.build.outputs.snap }}
tag: ${{ env.RELEASE_VERSION }}
if: env.SHOULD_DEPLOY_TO_RELEASE == 'yes'
1 change: 1 addition & 0 deletions .github/workflows/stable-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ jobs:
runs-on: ubuntu-latest
env:
APP_NAME: codium
RELEASE_VERSION: ${{ needs.build.outputs.RELEASE_VERSION }}
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ build/windows/msi/releasedir
build/windows/msi/Files*.wxs
build/windows/msi/Files*.wixobj
remote-dependencies.tar
stores/snapcraft/.build
stores/snapcraft/out
21 changes: 0 additions & 21 deletions check_tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,6 @@ if [[ "${ASSETS}" != "null" ]]; then
export SHOULD_BUILD_REH="no"
fi

if [[ -z $( contains "arm64.snap" ) ]]; then
echo "Building on Linux arm64 because we have no Snap"
export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_SNAP="no"
fi

export SHOULD_BUILD_APPIMAGE="no"

if [[ "${SHOULD_BUILD}" != "yes" ]]; then
Expand Down Expand Up @@ -283,7 +276,6 @@ if [[ "${ASSETS}" != "null" ]]; then
fi

export SHOULD_BUILD_APPIMAGE="no"
export SHOULD_BUILD_SNAP="no"

if [[ "${SHOULD_BUILD}" != "yes" ]]; then
echo "Already have all the Linux arm builds"
Expand All @@ -294,7 +286,6 @@ if [[ "${ASSETS}" != "null" ]]; then
SHOULD_BUILD_APPIMAGE="no"
SHOULD_BUILD_DEB="no"
SHOULD_BUILD_RPM="no"
SHOULD_BUILD_SNAP="no"
SHOULD_BUILD_TAR="no"

if [[ -z $( contains "${APP_NAME_LC}-reh-linux-ppc64le-${RELEASE_VERSION}.tar.gz" ) ]]; then
Expand Down Expand Up @@ -338,13 +329,6 @@ if [[ "${ASSETS}" != "null" ]]; then
export SHOULD_BUILD_APPIMAGE="no"
fi

if [[ -z $( contains "amd64.snap" ) ]]; then
echo "Building on Linux x64 because we have no Snap"
export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_SNAP="no"
fi

if [[ -z $( contains "${APP_NAME_LC}-reh-linux-x64-${RELEASE_VERSION}.tar.gz" ) ]]; then
echo "Building on Linux x64 because we have no REH archive"
export SHOULD_BUILD="yes"
Expand All @@ -364,15 +348,11 @@ else
if [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
SHOULD_BUILD_DEB="no"
SHOULD_BUILD_RPM="no"
SHOULD_BUILD_SNAP="no"
SHOULD_BUILD_TAR="no"
fi
if [[ "${VSCODE_ARCH}" != "x64" ]]; then
export SHOULD_BUILD_APPIMAGE="no"
fi
if [[ "${VSCODE_ARCH}" != "arm64" && "${VSCODE_ARCH}" != "x64" ]]; then
export SHOULD_BUILD_SNAP="no"
fi
elif [[ "${OS_NAME}" == "windows" ]]; then
if [[ "${VSCODE_ARCH}" == "arm64" ]]; then
export SHOULD_BUILD_REH="no"
Expand All @@ -394,7 +374,6 @@ echo "SHOULD_BUILD_MSI=${SHOULD_BUILD_MSI}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_MSI_NOUP=${SHOULD_BUILD_MSI_NOUP}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_REH=${SHOULD_BUILD_REH}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_RPM=${SHOULD_BUILD_RPM}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_SNAP=${SHOULD_BUILD_SNAP}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_TAR=${SHOULD_BUILD_TAR}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_ZIP=${SHOULD_BUILD_ZIP}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_SRC=${SHOULD_BUILD_SRC}" >> "${GITHUB_ENV}"
11 changes: 1 addition & 10 deletions prepare_assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ elif [[ "${OS_NAME}" == "windows" ]]; then
else
cd vscode || { echo "'vscode' dir not found"; exit 1; }

if [[ "${SHOULD_BUILD_DEB}" != "no" || "${SHOULD_BUILD_APPIMAGE}" != "no" || "${SHOULD_BUILD_SNAP}" != "no" ]]; then
if [[ "${SHOULD_BUILD_DEB}" != "no" || "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then
yarn gulp "vscode-linux-${VSCODE_ARCH}-build-deb"
fi

Expand All @@ -137,10 +137,6 @@ else
. ../build/linux/appimage/build.sh
fi

if [[ "${SHOULD_BUILD_SNAP}" != "no" ]]; then
. ../stores/snapcraft/build.sh
fi

cd ..

if [[ "${SHOULD_BUILD_TAR}" != "no" ]]; then
Expand All @@ -167,11 +163,6 @@ else
find assets -name '*.AppImage*' -exec bash -c 'mv $0 ${0/_-_/-}' {} \;
fi

if [[ "${SHOULD_BUILD_SNAP}" != "no" ]]; then
echo "Moving Snap"
mv stores/snapcraft/.build/*.snap assets/
fi

VSCODE_PLATFORM="linux"
fi

Expand Down
58 changes: 30 additions & 28 deletions stores/snapcraft/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,61 @@ if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
ICON_NAME="${ICON_NAME}-insiders"
fi

rm -rf .build
mkdir -p .build/snap/gui

DEB_ARCHIVE=$( ls ../../vscode/.build/linux/deb/amd64/deb/*.deb )

if [[ -z "${DEB_ARCHIVE}" ]]; then
ARCHITECTURE=$( dpkg --print-architecture )
rm -rf out
mkdir -p out/snap/gui

if [[ "${CI_BUILD}" == "no" ]]; then
DEB_ARCHIVE=$( ls ../../vscode/out/linux/deb/amd64/deb/*.deb )
else
# Get GitHub releases
wget --quiet "https://api.github.com/repos/${ASSETS_REPOSITORY}/releases" -O latest.json
wget --quiet "https://api.github.com/repos/${ASSETS_REPOSITORY}/releases" -O gh_latest.json

DEB_URL=$( jq -r 'map(select(.tag_name == "'"${RELEASE_VERSION}"'"))|first.assets[].browser_download_url|select(endswith("'"_${ARCHITECTURE}.deb"'"))' latest.json )
DEB_URL=$( jq -r 'map(select(.tag_name == "'"${RELEASE_VERSION}"'"))|first.assets[].browser_download_url|select(endswith("'"_${ARCHITECTURE}.deb"'"))' gh_latest.json )
DEB_ARCHIVE=$( basename "${DEB_URL}" )

# Downloading .deb
wget "${DEB_URL}" -O "${DEB_ARCHIVE}"

rm latest.json
rm gh_latest.json
fi

# Unpacking .deb
dpkg -x "${DEB_ARCHIVE}" .build/deb
dpkg -x "${DEB_ARCHIVE}" out/deb

mkdir -p .build/snap/usr/share
mv ".build/deb/usr/share/${BINARY_NAME}" ".build/snap/usr/share/${BINARY_NAME}"
mkdir -p out/snap/usr/share
mv "out/deb/usr/share/${BINARY_NAME}" "out/snap/usr/share/${BINARY_NAME}"

# Prepare snapcraft.yaml
cp ${VSCODE_QUALITY}/snapcraft.yaml .build/snap/snapcraft.yaml
cp ${VSCODE_QUALITY}/snapcraft.yaml out/snap/snapcraft.yaml

replace "s|@@SNAP_NAME@@|${BINARY_NAME}|g" .build/snap/snapcraft.yaml
replace "s|@@SNAP_VERSION@@|${SNAP_VERSION}|g" .build/snap/snapcraft.yaml
replace "s|@@SNAP_NAME@@|${BINARY_NAME}|g" out/snap/snapcraft.yaml
replace "s|@@SNAP_VERSION@@|${SNAP_VERSION}|g" out/snap/snapcraft.yaml

# Prepare electron-launch
cp ${VSCODE_QUALITY}/electron-launch .build/snap/electron-launch
cp ${VSCODE_QUALITY}/electron-launch out/snap/electron-launch

# Prepare GUI
cp "../../src/${VSCODE_QUALITY}/resources/linux/code.png" ".build/snap/gui/${BINARY_NAME}.png"
cp .build/deb/usr/share/applications/*.desktop .build/snap/gui
cp "../../src/${VSCODE_QUALITY}/resources/linux/code.png" "out/snap/gui/${BINARY_NAME}.png"
cp out/deb/usr/share/applications/*.desktop out/snap/gui

sed -i "s|Exec=/usr/share/${BINARY_NAME}/${BINARY_NAME}|Exec=${BINARY_NAME} --force-user-env|g" ".build/snap/gui/${BINARY_NAME}.desktop"
sed -i "s|Exec=/usr/share/${BINARY_NAME}/${BINARY_NAME}|Exec=${BINARY_NAME} --force-user-env|g" ".build/snap/gui/${BINARY_NAME}-url-handler.desktop"
sed -i "s|Icon=${ICON_NAME}|Icon=\${SNAP}/meta/gui/${BINARY_NAME}.png|g" ".build/snap/gui/${BINARY_NAME}.desktop"
sed -i "s|Icon=${ICON_NAME}|Icon=\${SNAP}/meta/gui/${BINARY_NAME}.png|g" ".build/snap/gui/${BINARY_NAME}-url-handler.desktop"
sed -i "s|Exec=/usr/share/${BINARY_NAME}/${BINARY_NAME}|Exec=${BINARY_NAME} --force-user-env|g" "out/snap/gui/${BINARY_NAME}.desktop"
sed -i "s|Exec=/usr/share/${BINARY_NAME}/${BINARY_NAME}|Exec=${BINARY_NAME} --force-user-env|g" "out/snap/gui/${BINARY_NAME}-url-handler.desktop"
sed -i "s|Icon=${ICON_NAME}|Icon=\${SNAP}/meta/gui/${BINARY_NAME}.png|g" "out/snap/gui/${BINARY_NAME}.desktop"
sed -i "s|Icon=${ICON_NAME}|Icon=\${SNAP}/meta/gui/${BINARY_NAME}.png|g" "out/snap/gui/${BINARY_NAME}-url-handler.desktop"

# Clean up
rm -rf .build/deb
rm -rf out/deb

cd .build
cd out

if [[ "${CI_BUILD}" != "no" ]]; then
snapcraft
else
if [[ "${CI_BUILD}" == "no" ]]; then
snapcraft --use-lxd --debug
# else
# snapcraft

# SNAP_ARCHIVE=$( ls *.snap )

# echo "snap=$( pwd )/${SNAP_ARCHIVE}" >> "$GITHUB_OUTPUT"
fi

cd "${CALLER_DIR}"
45 changes: 24 additions & 21 deletions stores/snapcraft/check_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,37 @@

set -e

if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
SNAP_NAME="${APP_NAME}-insiders"
else
SNAP_NAME="${APP_NAME}"
fi

sudo snap install --channel stable --classic snapcraft
export SHOULD_BUILD="no"
export SHOULD_DEPLOY_TO_RELEASE="no"
export SHOULD_DEPLOY_TO_STORE="no"

echo "Architecture: ${ARCHITECTURE}"
if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
wget --quiet "https://api.github.com/repos/${ASSETS_REPOSITORY}/releases" -O gh_latest.json
SNAP_URL=$( jq -r 'map(select(.tag_name == "'"${RELEASE_VERSION}"'"))|first.assets[].browser_download_url|select(endswith("'"_${ARCHITECTURE}.snap"'"))' gh_latest.json )

SNAP_VERSION=$( snapcraft list-revisions "${SNAP_NAME}" | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4 )
echo "Snap version: ${SNAP_VERSION}"
if [[ -z "${SNAP_URL}" ]]; then
export SHOULD_BUILD="yes"
export SHOULD_DEPLOY_TO_RELEASE="yes"
fi
else
sudo snap install --channel stable --classic snapcraft

wget --quiet "https://api.github.com/repos/${ASSETS_REPOSITORY}/releases" -O gh_latest.json
GH_VERSION=$( jq -r 'sort_by(.tag_name)|last.tag_name' gh_latest.json )
echo "GH version: ${GH_VERSION}"
echo "Architecture: ${ARCHITECTURE}"

rm -f gh_latest.json
SNAP_VERSION=$( snapcraft list-revisions "${SNAP_NAME}" | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4 )
echo "Snap version: ${SNAP_VERSION}"

if [[ "${SNAP_VERSION}" == "${GH_VERSION}" ]]; then
export SHOULD_DEPLOY="no"
else
export SHOULD_DEPLOY="yes"
if [[ "${SNAP_VERSION}" != "${RELEASE_VERSION}" ]]; then
export SHOULD_BUILD="yes"
export SHOULD_DEPLOY_TO_STORE="yes"

snap version
snap info "${SNAP_NAME}" || true
snap version
snap info "${SNAP_NAME}" || true
fi
fi

if [[ "${GITHUB_ENV}" ]]; then
echo "SHOULD_DEPLOY=${SHOULD_DEPLOY}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD=${SHOULD_BUILD}" >> "${GITHUB_ENV}"
echo "SHOULD_DEPLOY_TO_RELEASE=${SHOULD_DEPLOY_TO_RELEASE}" >> "${GITHUB_ENV}"
echo "SHOULD_DEPLOY_TO_STORE=${SHOULD_DEPLOY_TO_STORE}" >> "${GITHUB_ENV}"
fi

0 comments on commit 10f9067

Please sign in to comment.