Skip to content

Add support for generating VSIX builds for Alpine Linux #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ jobs:

strategy:
matrix:
os: [linux, windows, darwin]
os: [alpine, linux, win32, darwin]
arch: [amd64, arm64]
include:
- arch: amd64
nodearch: x64
- arch: arm64
nodearch: arm64
- os: windows
- os: win32
nodeos: win32
ext: .exe
- os: darwin
Expand All @@ -90,6 +90,9 @@ jobs:
- os: linux
nodeos: linux
ext: ""
- os: alpine
nodeos: linux
ext: ""

steps:
- name: actions/checkout@v4 (docker/vscode-extension)
Expand All @@ -103,7 +106,7 @@ jobs:

- working-directory: vscode-extension
run: |
npm install
NODE_OS=${{ matrix.nodeos }} NODE_ARCH=${{ matrix.nodearch }} npm install

- name: Set variables
id: set-variables
Expand All @@ -123,14 +126,14 @@ jobs:
working-directory: vscode-extension
run: |
npm install -g @vscode/vsce
vsce package --target ${{ matrix.nodeos }}-${{ matrix.nodearch }} -o docker-vscode-extension-${{ matrix.nodeos }}-${{ matrix.nodearch }}-$VERSION-$SHA.vsix
vsce package --target ${{ matrix.os }}-${{ matrix.nodearch }} -o docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-$VERSION-$SHA.vsix

- name: actions/upload-artifact@v4 (refs/heads)
if: startsWith(github.ref, 'refs/heads')
uses: actions/upload-artifact@v4
with:
name: docker-vscode-extension-${{ matrix.nodeos }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}-${{ steps.set-variables.outputs.SHA }}.vsix
path: vscode-extension/docker-vscode-extension-${{ matrix.nodeos }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}-${{ steps.set-variables.outputs.SHA }}.vsix
name: docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}-${{ steps.set-variables.outputs.SHA }}.vsix
path: vscode-extension/docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}-${{ steps.set-variables.outputs.SHA }}.vsix
if-no-files-found: error

- name: Build the extension (refs/tags/v)
Expand All @@ -140,19 +143,19 @@ jobs:
working-directory: vscode-extension
run: |
npm install -g @vscode/vsce
vsce package --target ${{ matrix.nodeos }}-${{ matrix.nodearch }} -o docker-vscode-extension-${{ matrix.nodeos }}-${{ matrix.nodearch }}-$VERSION.vsix
vsce package --target ${{ matrix.os }}-${{ matrix.nodearch }} -o docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-$VERSION.vsix

- name: actions/upload-artifact@v4 (refs/tags/v)
uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
name: docker-vscode-extension-${{ matrix.nodeos }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
path: vscode-extension/docker-vscode-extension-${{ matrix.nodeos }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
name: docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
path: vscode-extension/docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
if-no-files-found: error

- uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8 https://github.com/softprops/action-gh-release/commit/c062e08bd532815e2082a85e87e3ef29c3e6d191
if: startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: vscode-extension/docker-vscode-extension-${{ matrix.nodeos }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
files: vscode-extension/docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to the Docker DX extension will be documented in this file.

## [Unreleased]

### Added

- add support for the `alpine-x64` and `alpine-arm64` targets

## [0.4.10] - 2025-04-21

### Changed
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ This extension currently supports the following operating systems and architectu
| Windows | `amd64`, `arm64` |
| macOS | `amd64`, `arm64` |
| Linux | `amd64`, `arm64` |
| Alpine | `amd64`, `arm64` |

If you are on an unsupported system, let us know of your interest in this extension so we can prioritize the work accordingly.

Expand Down
25 changes: 23 additions & 2 deletions build/downloader.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,25 @@ async function downloadSyntaxesFile() {
run('syntaxes', url, hclSyntaxFile);
}

function getPlatform() {
const platform =
process.env['NODE_OS'] === undefined
? process.platform
: process.env['NODE_OS'];
if (platform === 'win32') {
return 'windows';
}
return platform === 'alpine' ? 'linux' : platform;
}

function getArch() {
const arch =
process.env['NODE_ARCH'] === undefined
? process.arch
: process.env['NODE_ARCH'];
return arch === 'x64' ? 'amd64' : 'arm64';
}

async function downloadLanguageServerBinary() {
if (process.arch !== 'x64' && process.arch !== 'arm64') {
console.error(
Expand All @@ -55,8 +74,10 @@ async function downloadLanguageServerBinary() {
process.exit(1);
}

const platform = process.platform === 'win32' ? 'windows' : process.platform;
const arch = process.arch === 'x64' ? 'amd64' : 'arm64';
const platform = getPlatform();
const arch = getArch();
console.log(platform);
console.log(arch);
const suffix = platform === 'windows' ? '.exe' : '';
const version = '0.3.7';
const binaryFile = `docker-language-server-${platform}-${arch}-v${version}${suffix}`;
Expand Down
Loading