Release #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- debian* | |
permissions: | |
contents: write | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DEBIAN_VERSION: "12" | |
DEBIAN_VERNAME: "bookworm" | |
DEBIAN_RELEASE: "20240201-1644" | |
DEBIAN_VARIANT: "genericcloud-amd64" | |
jobs: | |
release: | |
name: Create release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create release draft | |
run: | | |
gh release create "${GITHUB_REF_NAME}" \ | |
--repo="${GITHUB_REPOSITORY}" \ | |
--title="${GITHUB_REF_NAME}" \ | |
--generate-notes \ | |
--latest \ | |
--draft | |
download: | |
name: Download image | |
runs-on: ubuntu-latest | |
steps: | |
- id: cache | |
name: Cache image | |
uses: actions/cache@v4 | |
with: | |
key: "debian-${{ env.DEBIAN_VERSION }}-${{ env.DEBIAN_VARIANT }}-${{ env.DEBIAN_RELEASE }}" | |
path: "*.qcow2" | |
- name: Download image | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: wget "https://cloud.debian.org/images/cloud/$DEBIAN_VERNAME/$DEBIAN_RELEASE/debian-${DEBIAN_VERSION}-${DEBIAN_VARIANT}-${DEBIAN_RELEASE}.qcow2" | |
rebuild-cloud-image: | |
name: Rebuild cloud image | |
needs: [release, download] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache image | |
uses: actions/cache/restore@v4 | |
with: | |
key: "debian-${{ env.DEBIAN_VERSION }}-${{ env.DEBIAN_VARIANT }}-${{ env.DEBIAN_RELEASE }}" | |
path: "*.qcow2" | |
- name: Install libguestfs | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y libguestfs-tools | |
- name: Rebuild image | |
run: | | |
sudo virt-customize -a *.qcow2 \ | |
--install qemu-guest-agent,locales-all,htop | |
- name: Cleanup image | |
run: sudo virt-sparsify --in-place *.qcow2 | |
- name: Upload artifacts | |
run: | | |
# gh release upload "debian-${DEBIAN_VERSION}-${DEBIAN_RELEASE}" *.qcow2 | |
gh release upload "${GITHUB_REF_NAME}" *.qcow2 | |
rebuild-docker-image: | |
name: Rebuild docker image | |
needs: [release, download] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache image | |
uses: actions/cache/restore@v4 | |
with: | |
key: "debian-${{ env.DEBIAN_VERSION }}-${{ env.DEBIAN_VARIANT }}-${{ env.DEBIAN_RELEASE }}" | |
path: "*.qcow2" | |
- name: Install libguestfs | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y libguestfs-tools | |
- name: Rebuild image | |
run: | | |
sudo virt-customize -a *.qcow2 \ | |
--install qemu-guest-agent,locales-all,htop | |
- name: Upload artifacts | |
run: | | |
mv *.qcow2 "debian-12-docker-amd64-20240201-1644.qcow2" | |
gh release upload "${GITHUB_REF_NAME}" *.qcow2 |