Skip to content

build rootfs

build rootfs #47

Workflow file for this run

name: build rootfs
on:
push:
branches:
- "main"
paths:
- ".github/workflows/**"
- "linux_files/**"
- "scripts/**"
- "Makefile"
workflow_dispatch:
schedule:
- cron: "0 10 */7 * *"
jobs:
build-rootfs:
runs-on: self-hosted
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate rootfs
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y make
make
sha256sum cachyos-v3-rootfs.wsl >cachyos-v3-rootfs.wsl.sha256
sha256sum cachyos-v4-rootfs.wsl >cachyos-v4-rootfs.wsl.sha256
sha256sum cachyos-znver4-rootfs.wsl >cachyos-znver4-rootfs.wsl.sha256
TAG_NAME=$(date +%Y%m%d)
jq -n '{ "ModernDistributions": { "CachyOS": [] } }' >DistributionInfo.json
cat *.sha256 | while read -r line; do
sha256=$(echo "$line" | awk '{print $1}')
filename=$(echo "$line" | awk '{print $2}')
if [[ "$filename" == *"v3"* ]]; then
Name="CachyOS"
FriendlyName="CachyOS (x86-64-v3)"
Default="true"
elif [[ "$filename" == *"v4"* ]]; then
Name="CachyOS_v4"
FriendlyName="CachyOS (x86-64-v4)"
Default="false"
elif [[ "$filename" == *"znver4"* ]]; then
Name="CachyOS_Zen4"
FriendlyName="CachyOS (Zen4)"
Default="false"
fi
jq --arg Name "$Name" \
--arg FriendlyName "$FriendlyName" \
--argjson Default "$Default" \
--arg Url "https://github.com/okrc/CachyOS-WSL/releases/download/$TAG_NAME/$filename" \
--arg Sha256 "$sha256" \
'.ModernDistributions.CachyOS += [{
"Name": $Name,
"FriendlyName": $FriendlyName,
"Default": $Default,
"Amd64Url": {
"Url": $Url,
"Sha256": $Sha256
}
}]' DistributionInfo.json >tmp.json && mv tmp.json DistributionInfo.json
done
tee /tmp/bodyfile.txt <<-EOF
### sha256sum
\`\`\`
$(cat *.sha256)
\`\`\`
EOF
echo "TAG_NAME=$TAG_NAME" >>$GITHUB_ENV
- name: Upload files to GitHub release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: |
cachyos-v3-rootfs.wsl
cachyos-v4-rootfs.wsl
cachyos-znver4-rootfs.wsl
DistributionInfo.json
bodyFile: /tmp/bodyfile.txt
tag: ${{ env.TAG_NAME }}