2022-06-14 14:37:10 +08:00
|
|
|
steps:
|
|
|
|
- task: NodeTool@0
|
|
|
|
inputs:
|
2024-04-30 20:57:13 +08:00
|
|
|
versionSource: fromFile
|
|
|
|
versionFilePath: .nvmrc
|
|
|
|
nodejsMirror: https://github.com/joaomoreno/node-mirror/releases/download
|
2022-06-14 14:37:10 +08:00
|
|
|
|
|
|
|
- task: DownloadPipelineArtifact@0
|
|
|
|
displayName: "Download Pipeline Artifact"
|
|
|
|
inputs:
|
|
|
|
artifactName: snap-$(VSCODE_ARCH)
|
|
|
|
targetPath: .build/linux/snap-tarball
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Get snapcraft version
|
|
|
|
snapcraft --version
|
|
|
|
|
|
|
|
# Make sure we get latest packages
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get upgrade -y
|
|
|
|
sudo apt-get install -y curl apt-transport-https ca-certificates
|
|
|
|
|
|
|
|
# Yarn
|
|
|
|
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
|
|
|
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y yarn
|
|
|
|
|
|
|
|
# Define variables
|
2024-04-30 20:57:13 +08:00
|
|
|
SNAP_ROOT="$(pwd)/.build/linux/snap/$(VSCODE_ARCH)"
|
2022-06-14 14:37:10 +08:00
|
|
|
|
|
|
|
# Install build dependencies
|
|
|
|
(cd build && yarn)
|
|
|
|
|
|
|
|
# Unpack snap tarball artifact, in order to preserve file perms
|
2024-04-30 20:57:13 +08:00
|
|
|
(cd .build/linux && tar -xzf snap-tarball/snap-$(VSCODE_ARCH).tar.gz)
|
2022-06-14 14:37:10 +08:00
|
|
|
|
|
|
|
# Create snap package
|
|
|
|
BUILD_VERSION="$(date +%s)"
|
|
|
|
SNAP_FILENAME="code-$VSCODE_QUALITY-$(VSCODE_ARCH)-$BUILD_VERSION.snap"
|
|
|
|
SNAP_PATH="$SNAP_ROOT/$SNAP_FILENAME"
|
|
|
|
case $(VSCODE_ARCH) in
|
|
|
|
x64) SNAPCRAFT_TARGET_ARGS="" ;;
|
|
|
|
*) SNAPCRAFT_TARGET_ARGS="--target-arch $(VSCODE_ARCH)" ;;
|
|
|
|
esac
|
2024-04-30 20:57:13 +08:00
|
|
|
(cd $SNAP_ROOT/code-* && sudo --preserve-env snapcraft snap $SNAPCRAFT_TARGET_ARGS --output "$SNAP_PATH")
|
2022-06-14 14:37:10 +08:00
|
|
|
|
|
|
|
# Export SNAP_PATH
|
|
|
|
echo "##vso[task.setvariable variable=SNAP_PATH]$SNAP_PATH"
|
|
|
|
displayName: Prepare for publish
|
|
|
|
|
2024-04-30 20:57:13 +08:00
|
|
|
- script: mkdir -p $(agent.builddirectory)/vscode-snap-linux-$(VSCODE_ARCH)
|
|
|
|
displayName: Make folder for SBOM
|
|
|
|
|
|
|
|
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
|
|
|
displayName: Generate SBOM
|
|
|
|
inputs:
|
|
|
|
BuildDropPath: $(agent.builddirectory)/vscode-snap-linux-$(VSCODE_ARCH)
|
|
|
|
PackageName: Visual Studio Code Snap
|
|
|
|
|
|
|
|
- publish: $(agent.builddirectory)/vscode-snap-linux-$(VSCODE_ARCH)/_manifest
|
|
|
|
displayName: Publish SBOM
|
|
|
|
artifact: $(ARTIFACT_PREFIX)sbom_vscode_client_linux_snap_$(VSCODE_ARCH)
|
|
|
|
|
2022-06-14 14:37:10 +08:00
|
|
|
- publish: $(SNAP_PATH)
|
|
|
|
artifact: vscode_client_linux_$(VSCODE_ARCH)_snap
|
|
|
|
displayName: Publish snap package
|