VS Code Extensions Tarball Generator
Categories:
GitLab: c2platform/phx/vs-code-extensions
This project aims to create a tarball of selected Visual Studio Code extensions based on a YAML file. This tarball can be used in air-gapped environments where direct access to the Visual Studio Code Marketplace is not possible.
Overview
The project consists of a Python script, download.py
, that reads a YAML file
containing extension details and downloads each specified extension. The
extensions are then packaged into a tarball for easy distribution.
Features
- Download VS Code extensions specified in a YAML file.
- Package downloaded extensions into a
.tar.gz
archive. - Utilize GitLab CI/CD to automate the building and packaging process.
Project Structure
download.py
: Python script to download extensions.vs-code-extensions.yaml
: Configuration file specifying the extensions to be downloaded..gitlab-ci.yml
: GitLab CI/CD configuration file to automate the build, package, and release processes.
Configuration
YAML File
The YAML file (vs-code-extensions.yaml
) should have the following structure to
specify extensions:
extensions:
- publisher: <publisher_name>
id: <extension_id>
version: <extension_version>
# Add more extensions as needed
Usage
Running Locally
Install Python dependencies (if any are specified).
Set up a YAML configuration file with the necessary extension details.
Run the script to download the extensions:
python3 download.py
Package the extensions using tar:
tar -czvf vs-code-extensions.tar.gz vs-code-extensions
Using GitLab CI/CD
The CI/CD pipeline is structured in the following stages:
- Build: Run the
download.py
script to download extensions. - Package: Create a tarball of the downloaded extensions, which is done manually and only on the master branch.
- Publish: Upload the tarball as an artifact.
- Release: On the master branch, create a new release with the tarball as an artifact.
Note:
- The CI/CD pipeline includes a prepare stage that extracts the version number
from a
CHANGELOG.md
file and sets it as an environment variable. - Ensure your
CHANGELOG.md
file is properly formatted with versioning for the pipeline to function correctly. - You can manually trigger the package stage, ensuring it only affects the master branch.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.