fix(snap): squash changes [skip ci]

This commit is contained in:
Baptiste Augrain 2024-02-08 16:10:05 +01:00
parent 96f53366b7
commit 3465153c6e
7 changed files with 90 additions and 103 deletions

View file

@ -215,15 +215,14 @@ jobs:
- build - build
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
APP_NAME: codium RELEASE_VERSION: ${{ needs.build.outputs.RELEASE_VERSION }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
platform: platform:
- amd64 - amd64
- arm64 - arm64
# if: needs.build.outputs.SHOULD_DEPLOY == 'yes' if: needs.build.outputs.SHOULD_DEPLOY == 'yes'
if: false
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -237,25 +236,37 @@ jobs:
run: ./stores/snapcraft/check_version.sh run: ./stores/snapcraft/check_version.sh
- uses: docker/setup-qemu-action@v3 - uses: docker/setup-qemu-action@v3
if: env.SHOULD_DEPLOY == 'yes' if: env.SHOULD_BUILD == 'yes'
- uses: diddlesnaps/snapcraft-multiarch-action@v1 - name: Prepare snapcraft.yaml
with:
path: stores/snapcraft/insider
architecture: ${{ matrix.platform }}
id: build
if: env.SHOULD_DEPLOY == 'yes'
- uses: diddlesnaps/snapcraft-review-action@v1
with:
snap: ${{ steps.build.outputs.snap }}
isClassic: 'true'
if: env.SHOULD_DEPLOY == 'yes'
- uses: snapcore/action-publish@master
env: env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }} 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: snapcore/action-build@v1
with: with:
snap: ${{ steps.build.outputs.snap }} path: stores/snapcraft/out
release: edge 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_BUILD == 'yes'
- uses: svenstaro/upload-release-action@v2
with:
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'

View file

@ -227,6 +227,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
APP_NAME: codium APP_NAME: codium
RELEASE_VERSION: ${{ needs.build.outputs.RELEASE_VERSION }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

2
.gitignore vendored
View file

@ -15,4 +15,4 @@ build/windows/msi/releasedir
build/windows/msi/Files*.wxs build/windows/msi/Files*.wxs
build/windows/msi/Files*.wixobj build/windows/msi/Files*.wixobj
remote-dependencies.tar remote-dependencies.tar
stores/snapcraft/.build stores/snapcraft/build

View file

@ -239,13 +239,6 @@ if [[ "${ASSETS}" != "null" ]]; then
export SHOULD_BUILD_REH="no" export SHOULD_BUILD_REH="no"
fi 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" export SHOULD_BUILD_APPIMAGE="no"
if [[ "${SHOULD_BUILD}" != "yes" ]]; then if [[ "${SHOULD_BUILD}" != "yes" ]]; then
@ -283,7 +276,6 @@ if [[ "${ASSETS}" != "null" ]]; then
fi fi
export SHOULD_BUILD_APPIMAGE="no" export SHOULD_BUILD_APPIMAGE="no"
export SHOULD_BUILD_SNAP="no"
if [[ "${SHOULD_BUILD}" != "yes" ]]; then if [[ "${SHOULD_BUILD}" != "yes" ]]; then
echo "Already have all the Linux arm builds" echo "Already have all the Linux arm builds"
@ -294,7 +286,6 @@ if [[ "${ASSETS}" != "null" ]]; then
SHOULD_BUILD_APPIMAGE="no" SHOULD_BUILD_APPIMAGE="no"
SHOULD_BUILD_DEB="no" SHOULD_BUILD_DEB="no"
SHOULD_BUILD_RPM="no" SHOULD_BUILD_RPM="no"
SHOULD_BUILD_SNAP="no"
SHOULD_BUILD_TAR="no" SHOULD_BUILD_TAR="no"
if [[ -z $( contains "${APP_NAME_LC}-reh-linux-ppc64le-${RELEASE_VERSION}.tar.gz" ) ]]; then if [[ -z $( contains "${APP_NAME_LC}-reh-linux-ppc64le-${RELEASE_VERSION}.tar.gz" ) ]]; then
@ -338,13 +329,6 @@ if [[ "${ASSETS}" != "null" ]]; then
export SHOULD_BUILD_APPIMAGE="no" export SHOULD_BUILD_APPIMAGE="no"
fi 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 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" echo "Building on Linux x64 because we have no REH archive"
export SHOULD_BUILD="yes" export SHOULD_BUILD="yes"
@ -364,15 +348,11 @@ else
if [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then if [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
SHOULD_BUILD_DEB="no" SHOULD_BUILD_DEB="no"
SHOULD_BUILD_RPM="no" SHOULD_BUILD_RPM="no"
SHOULD_BUILD_SNAP="no"
SHOULD_BUILD_TAR="no" SHOULD_BUILD_TAR="no"
fi fi
if [[ "${VSCODE_ARCH}" != "x64" ]]; then if [[ "${VSCODE_ARCH}" != "x64" ]]; then
export SHOULD_BUILD_APPIMAGE="no" export SHOULD_BUILD_APPIMAGE="no"
fi fi
if [[ "${VSCODE_ARCH}" != "arm64" && "${VSCODE_ARCH}" != "x64" ]]; then
export SHOULD_BUILD_SNAP="no"
fi
elif [[ "${OS_NAME}" == "windows" ]]; then elif [[ "${OS_NAME}" == "windows" ]]; then
if [[ "${VSCODE_ARCH}" == "arm64" ]]; then if [[ "${VSCODE_ARCH}" == "arm64" ]]; then
export SHOULD_BUILD_REH="no" export SHOULD_BUILD_REH="no"
@ -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_MSI_NOUP=${SHOULD_BUILD_MSI_NOUP}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_REH=${SHOULD_BUILD_REH}" >> "${GITHUB_ENV}" echo "SHOULD_BUILD_REH=${SHOULD_BUILD_REH}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_RPM=${SHOULD_BUILD_RPM}" >> "${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_TAR=${SHOULD_BUILD_TAR}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_ZIP=${SHOULD_BUILD_ZIP}" >> "${GITHUB_ENV}" echo "SHOULD_BUILD_ZIP=${SHOULD_BUILD_ZIP}" >> "${GITHUB_ENV}"
echo "SHOULD_BUILD_SRC=${SHOULD_BUILD_SRC}" >> "${GITHUB_ENV}" echo "SHOULD_BUILD_SRC=${SHOULD_BUILD_SRC}" >> "${GITHUB_ENV}"

View file

@ -125,7 +125,7 @@ elif [[ "${OS_NAME}" == "windows" ]]; then
else else
cd vscode || { echo "'vscode' dir not found"; exit 1; } 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" yarn gulp "vscode-linux-${VSCODE_ARCH}-build-deb"
fi fi
@ -137,10 +137,6 @@ else
. ../build/linux/appimage/build.sh . ../build/linux/appimage/build.sh
fi fi
if [[ "${SHOULD_BUILD_SNAP}" != "no" ]]; then
. ../stores/snapcraft/build.sh
fi
cd .. cd ..
if [[ "${SHOULD_BUILD_TAR}" != "no" ]]; then if [[ "${SHOULD_BUILD_TAR}" != "no" ]]; then
@ -167,11 +163,6 @@ else
find assets -name '*.AppImage*' -exec bash -c 'mv $0 ${0/_-_/-}' {} \; find assets -name '*.AppImage*' -exec bash -c 'mv $0 ${0/_-_/-}' {} \;
fi fi
if [[ "${SHOULD_BUILD_SNAP}" != "no" ]]; then
echo "Moving Snap"
mv stores/snapcraft/.build/*.snap assets/
fi
VSCODE_PLATFORM="linux" VSCODE_PLATFORM="linux"
fi fi

View file

@ -16,59 +16,61 @@ if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
ICON_NAME="${ICON_NAME}-insiders" ICON_NAME="${ICON_NAME}-insiders"
fi fi
rm -rf .build rm -rf build
mkdir -p .build/snap/gui mkdir -p build/snap/gui
DEB_ARCHIVE=$( ls ../../vscode/.build/linux/deb/amd64/deb/*.deb )
if [[ -z "${DEB_ARCHIVE}" ]]; then
ARCHITECTURE=$( dpkg --print-architecture )
if [[ "${CI_BUILD}" == "no" ]]; then
DEB_ARCHIVE=$( ls ../../vscode/build/linux/deb/amd64/deb/*.deb )
else
# Get GitHub releases # 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}" ) DEB_ARCHIVE=$( basename "${DEB_URL}" )
# Downloading .deb # Downloading .deb
wget "${DEB_URL}" -O "${DEB_ARCHIVE}" wget "${DEB_URL}" -O "${DEB_ARCHIVE}"
rm latest.json rm gh_latest.json
fi fi
# Unpacking .deb # Unpacking .deb
dpkg -x "${DEB_ARCHIVE}" .build/deb dpkg -x "${DEB_ARCHIVE}" build/deb
mkdir -p .build/snap/usr/share mkdir -p build/snap/usr/share
mv ".build/deb/usr/share/${BINARY_NAME}" ".build/snap/usr/share/${BINARY_NAME}" mv "build/deb/usr/share/${BINARY_NAME}" "build/snap/usr/share/${BINARY_NAME}"
# Prepare snapcraft.yaml # Prepare snapcraft.yaml
cp ${VSCODE_QUALITY}/snapcraft.yaml .build/snap/snapcraft.yaml cp ${VSCODE_QUALITY}/snapcraft.yaml build/snap/snapcraft.yaml
replace "s|@@SNAP_NAME@@|${BINARY_NAME}|g" .build/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_VERSION@@|${SNAP_VERSION}|g" build/snap/snapcraft.yaml
# Prepare electron-launch # Prepare electron-launch
cp ${VSCODE_QUALITY}/electron-launch .build/snap/electron-launch cp ${VSCODE_QUALITY}/electron-launch build/snap/electron-launch
# Prepare GUI # Prepare GUI
cp "../../src/${VSCODE_QUALITY}/resources/linux/code.png" ".build/snap/gui/${BINARY_NAME}.png" 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 build/deb/usr/share/applications/*.desktop build/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}.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|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}.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|Icon=${ICON_NAME}|Icon=\${SNAP}/meta/gui/${BINARY_NAME}.png|g" "build/snap/gui/${BINARY_NAME}-url-handler.desktop"
# Clean up # Clean up
rm -rf .build/deb rm -rf build/deb
cd .build cd build
if [[ "${CI_BUILD}" != "no" ]]; then if [[ "${CI_BUILD}" == "no" ]]; then
snapcraft
else
snapcraft --use-lxd --debug snapcraft --use-lxd --debug
# else
# snapcraft
# SNAP_ARCHIVE=$( ls *.snap )
# echo "snap=$( pwd )/${SNAP_ARCHIVE}" >> "$GITHUB_OUTPUT"
fi fi
cd "${CALLER_DIR}" cd "${CALLER_DIR}"

View file

@ -2,34 +2,37 @@
set -e set -e
export SHOULD_BUILD="no"
export SHOULD_DEPLOY_TO_RELEASE="no"
export SHOULD_DEPLOY_TO_STORE="no"
if [[ "${VSCODE_QUALITY}" == "insider" ]]; then if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
SNAP_NAME="${APP_NAME}-insiders" 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 )
if [[ -z "${SNAP_URL}" ]]; then
export SHOULD_BUILD="yes"
export SHOULD_DEPLOY_TO_RELEASE="yes"
fi
else else
SNAP_NAME="${APP_NAME}" sudo snap install --channel stable --classic snapcraft
fi
sudo snap install --channel stable --classic snapcraft echo "Architecture: ${ARCHITECTURE}"
echo "Architecture: ${ARCHITECTURE}" SNAP_VERSION=$( snapcraft list-revisions "${SNAP_NAME}" | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4 )
echo "Snap version: ${SNAP_VERSION}"
SNAP_VERSION=$( snapcraft list-revisions "${SNAP_NAME}" | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4 ) if [[ "${SNAP_VERSION}" != "${RELEASE_VERSION}" ]]; then
echo "Snap version: ${SNAP_VERSION}" export SHOULD_BUILD="yes"
export SHOULD_DEPLOY_TO_STORE="yes"
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}"
rm -f gh_latest.json
if [[ "${SNAP_VERSION}" == "${GH_VERSION}" ]]; then
export SHOULD_DEPLOY="no"
else
export SHOULD_DEPLOY="yes"
snap version snap version
snap info "${SNAP_NAME}" || true snap info "${SNAP_NAME}" || true
fi
fi fi
if [[ "${GITHUB_ENV}" ]]; then 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 fi