Skip to content

Commit ab26c08

Browse files
committed
feat!: migrate to wsl modern distribution
1 parent 2bd1464 commit ab26c08

File tree

94 files changed

+672
-2207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+672
-2207
lines changed

.editorconfig

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
end_of_line = lf
8+
charset = utf-8
9+
indent_style = space
10+
indent_size = 2
11+
12+
[*.sh]
13+
# --language-variant
14+
shell_variant = bash
15+
binary_next_line = true
16+
# --case-indent
17+
switch_case_indent = true
18+
19+
[*.md]
20+
max_line_length = 80
21+
indent_size = 4

.github/workflows/release.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414
- name: Download artifacts
15-
uses: actions/download-artifact@v3
15+
uses: actions/download-artifact@v4
1616
- name: Create release
1717
run: |
18-
tag=$(cat package/tag.txt)
19-
imagetag=$(cat package/imagetag.txt)
20-
gh release create "${tag::-1}" --notes "Arch Linux WSL installer based on the Docker image \`archlinux:${imagetag::-1}\`" ./package/x64/Release/DistroLauncher-Appx/*.msix ./package/DistroLauncher-Appx_TemporaryKey.crt
18+
imagetag=$(cat artifacts/imagetag.txt)
19+
tag="${imagetag#base-}"
20+
gh release create "${tag}" --notes "Arch Linux WSL modern distribution based on the Docker image \`archlinux:${imagetag}\`" ./artifacts/archlinux.wsl.gz ./artifacts/DistributionInfo.json
2121
env:
2222
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/reusable-package.yml

+32-67
Original file line numberDiff line numberDiff line change
@@ -2,85 +2,50 @@ name: Reusable package
22
on:
33
workflow_call:
44
secrets:
5-
DOCKER_HUB_USERNAME:
6-
required: true
75
DOCKER_HUB_PAT:
86
required: true
9-
PFX_BASE64:
7+
DOCKER_HUB_USERNAME:
108
required: true
119
jobs:
12-
image:
10+
build:
1311
runs-on: ubuntu-latest
1412
steps:
1513
- name: Checkout
16-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1715
- name: Build image
18-
run: |
19-
docker build -t archwsl .
20-
docker run --name archwsl -t archwsl ls
21-
docker export archwsl > install.tar
22-
gzip install.tar
23-
- name: Upload image
24-
uses: actions/upload-artifact@v3
25-
with:
26-
name: image
27-
path: install.tar.gz
28-
if-no-files-found: error
29-
build:
30-
needs: image
31-
runs-on: windows-latest
32-
steps:
33-
- name: Checkout
34-
uses: actions/checkout@v3
35-
- name: Download artifact
36-
uses: actions/download-artifact@v3
37-
- name: Create image directory
38-
shell: pwsh
39-
run: |
40-
New-Item -Path . -Name x64 -ItemType Directory
41-
Copy-Item -Path image\install.tar.gz -Destination x64
42-
- name: Update version
43-
shell: pwsh
4416
env:
45-
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
4617
DOCKER_HUB_PAT: ${{ secrets.DOCKER_HUB_PAT }}
18+
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
4719
run: |
48-
$request = "{ ""username"": ""$env:DOCKER_HUB_USERNAME"", ""password"": ""$env:DOCKER_HUB_PAT"" }"
49-
$token = (Invoke-RestMethod -Uri https://hub.docker.com/v2/users/login -Method Post -Headers @{ "Content-Type" = "application/json" } -Body $request).token
50-
$digest = (Invoke-RestMethod -Uri https://hub.docker.com/v2/namespaces/library/repositories/archlinux/tags/base -Method Get -Headers @{ "Authorization" = "Bearer ${token}" }).digest
51-
$tags = (Invoke-RestMethod -Uri "https://hub.docker.com/v2/namespaces/library/repositories/archlinux/tags/?page=1&page_size=100" -Method Get -Headers @{ "Authorization" = "Bearer ${token}" }).results
52-
$imagetag = ($tags | Where-Object { $_.name -like "base-*" -and $_.digest -eq $digest}).name
53-
$imagebuild = $imagetag.split(".")[-1]
54-
$version = "1." + [System.Text.Encoding]::UTF8.GetString($imagebuild[0..($imagebuild.Length - 5)]) + "." + [System.Text.Encoding]::UTF8.GetString($imagebuild[-4..-1])
55-
$manifest = (Get-Content -Path .\DistroLauncher-Appx\MyDistro.appxmanifest)
56-
$manifest = $manifest -creplace '(\bVersion=)"[\d.]+"', ('$1"' + $version + '.0"')
57-
$manifest > .\DistroLauncher-Appx\MyDistro.appxmanifest
58-
$imagetag > .\imagetag.txt
59-
"v$version" > .\tag.txt
60-
- name: Update thumbprint
61-
shell: pwsh
62-
env:
63-
PFX_BASE64: ${{ secrets.PFX_BASE64 }}
64-
run: |
65-
$pfx = [System.Convert]::FromBase64String($env:PFX_BASE64)
66-
Set-Content -Path .\DistroLauncher-Appx\DistroLauncher-Appx_TemporaryKey.pfx -Value $pfx -AsByteStream
67-
$thumbprint = (Get-PfxCertificate -FilePath .\DistroLauncher-Appx\DistroLauncher-Appx_TemporaryKey.pfx -NoPromptForPassword).Thumbprint
68-
$vcxproj = (Get-Content -Path .\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj)
69-
$vcxproj = $vcxproj -creplace '(<PackageCertificateThumbprint>).*(</PackageCertificateThumbprint>)', ('$1' + $thumbprint + '$2')
70-
$vcxproj > .\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj
71-
- name: Export certificate
72-
shell: pwsh
73-
run: "openssl pkcs12 -in .\\DistroLauncher-Appx\\DistroLauncher-Appx_TemporaryKey.pfx -out .\\DistroLauncher-Appx_TemporaryKey.crt -nokeys -passin pass:"
74-
- name: Build
75-
shell: pwsh
76-
run: .\build.bat rel
77-
- name: Upload package
78-
uses: actions/upload-artifact@v3
20+
./build
21+
gzip --best archlinux.wsl
22+
sha256=$(sha256sum archlinux.wsl.gz)
23+
read -r sha256 _ <<<"${sha256}"
24+
tag=$(cat imagetag.txt)
25+
version="${tag#base-}"
26+
cat <<EOF >DistributionInfo.json
27+
{
28+
"ModernDistributions": {
29+
"Arch-Linux-Unofficial": [
30+
{
31+
"Name": "Arch-Linux-Unofficial-${tag}",
32+
"Default": true,
33+
"FriendlyName": "Arch Linux Unofficial version ${version} (latest)",
34+
"Amd64Url": {
35+
"Url": "https://github.com/DevelopersCommunity/archlinux-wsl/releases/download/${version}/archlinux.wsl.gz",
36+
"Sha256": "${sha256}"
37+
}
38+
}
39+
]
40+
}
41+
}
42+
EOF
43+
- name: Upload artifacts
44+
uses: actions/upload-artifact@v4
7945
with:
80-
name: package
46+
name: artifacts
8147
path: |
82-
x64\Release\DistroLauncher-Appx\DistroLauncher-Appx_*_x64.msix
83-
DistroLauncher-Appx_TemporaryKey.crt
48+
archlinux.wsl.gz
8449
imagetag.txt
85-
tag.txt
50+
DistributionInfo.json
8651
if-no-files-found: error

0 commit comments

Comments
 (0)