Skip to content

chore(deps): update dependency mise to v2024.12.11 #163

chore(deps): update dependency mise to v2024.12.11

chore(deps): update dependency mise to v2024.12.11 #163

Workflow file for this run

name: Build Ubuntu WSL Docker image
on:
schedule:
# update once a week
- cron: "0 0 * * SUN"
push:
branches:
- main
paths:
- .github/workflows/wsl-docker.yml
pull_request:
branches:
- main
paths:
- .github/workflows/wsl-docker.yml
workflow_dispatch:
permissions: {}
defaults:
run:
shell: bash
jobs:
build-wsl:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
packages: write # for GitHub Package Registry
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/wsl
steps:
- name: Install mise
uses: jdx/mise-action@5bb8f8c1911837cf42064e6490e7634fc842ee7e # v2.1.8
with:
version: 2024.12.11
# cspell:ignore kellyjonbrazil
mise_toml: |
[tools]
"ubi:kellyjonbrazil/jc" = "latest"
cache_save: ${{ github.ref_name == 'main' }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Get latest Ubuntu version
id: version
run: |
today=$(date --utc --iso-8601)
read -r version series < <(
curl --fail-with-body --location https://debian.pages.debian.net/distro-info-data/ubuntu.csv \
| jc --csv \
| jq --arg today "${today}" -r '
[ .[]
| select(.version | contains("LTS"))
| select(.release <= $today)
| {series, version: (.version | sub(" LTS"; ""))}
]
| sort_by(.release)
| reverse
| .[0]
| "\(.version) \(.series)"
'
)
echo "version=${version}" >> "${GITHUB_OUTPUT}"
echo "series=${series}" >> "${GITHUB_OUTPUT}"
- name: Get Ubuntu WSL build info
id: build-info
run: |
serial=$(curl --fail-with-body --location https://cloud-images.ubuntu.com/wsl/${{ steps.version.outputs.series }}/current/unpacked/build-info.txt \
| grep --only-matching --perl-regexp 'SERIAL=\K\d+')
if [[ -z "${serial}" ]]; then
echo "Failed to get the serial" >&2
exit 1
fi
# + is appropriate for build date as semver but it cannot be used in docker tag
# use . instead because - is treated as platform/compatibility indicator by renovate
# ref: https://docs.renovatebot.com/modules/versioning/docker/
echo "tag=${{ steps.version.outputs.version }}.${serial}" >> "${GITHUB_OUTPUT}"
- name: Get latest Ubuntu WSL image tag
id: latest-tag
# %2F is the URL-encoded form of /
# get the tag of the latest image
# cspell:ignore fwsl
run: |
latest_tag=$(gh api --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" \
/user/packages/container/${{ github.event.repository.name }}%2Fwsl/versions \
--jq '.[] | select(.metadata.container.tags | contains(["latest"])) | .metadata.container.tags[] | select(. != "latest")')
echo "latest_tag=${latest_tag}" >> "${GITHUB_OUTPUT}"
env:
GITHUB_TOKEN: ${{ github.token }}
# 404 error for the first run
continue-on-error: true
# cspell:ignore rootfs
- name: Download Ubuntu WSL rootfs
id: rootfs
# skip if the latest image is already created
if: ${{ github.event_name == 'pull_request' || steps.build-info.outputs.tag != steps.latest-tag.outputs.latest_tag }}
run: |
curl --fail-with-body --location --output ubuntu.tar.gz \
https://cloud-images.ubuntu.com/wsl/${{ steps.version.outputs.series }}/current/ubuntu-${{ steps.version.outputs.series }}-wsl-amd64-ubuntu.rootfs.tar.gz
- name: Create Dockerfile
if: ${{ steps.rootfs.outcome != 'skipped' }}
run: |
cat <<EOF > Dockerfile
FROM scratch
ADD ubuntu.tar.gz /
EOF
- name: Login to GitHub Container Registry
if: ${{ steps.rootfs.outcome != 'skipped' }}
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ github.token }}
# cspell:ignore buildx
- name: Setup Buildx
if: ${{ steps.rootfs.outcome != 'skipped' }}
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
- name: Build and push Docker image
id: push
if: ${{ steps.rootfs.outcome != 'skipped' }}
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
# create a new package if the image is not found
push: ${{ github.event_name != 'pull_request' || steps.latest-tag.outcome == 'failure' }}
# avoid image without manifest created
# ref: https://github.com/docker/build-push-action/issues/900
provenance: false
tags: |
ghcr.io/${{ env.IMAGE_NAME }}:${{ steps.build-info.outputs.tag }}
ghcr.io/${{ env.IMAGE_NAME }}:latest
cache-from: type=gha
# disable cache saving for non-default branches
# ref: https://github.com/docker/build-push-action/issues/845
cache-to: ${{ github.ref_name == 'main' && 'type=gha,mode=max' || '' }}
actions-timeline:
needs:
- build-wsl
if: ${{ !cancelled() }}
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
actions: read # for actions-timeline
steps:
- name: actions-timeline
# cspell:ignore kesin
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1