mirror of
https://github.com/quickemu-project/quickemu.git
synced 2024-06-10 17:05:22 +02:00
130 lines
4.2 KiB
YAML
130 lines
4.2 KiB
YAML
name: Publish Release 🏷️
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v?[0-9]+.[0-9]+.[0-9]+*"
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "The existing tag to publish"
|
|
type: "string"
|
|
required: true
|
|
|
|
jobs:
|
|
version-check:
|
|
name: "Check versions ⚖️"
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: "Compare App and Git versions 🟰"
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
APP_VERSION=$(grep "^readonly VERSION" quickemu | cut -d'"' -f2)
|
|
GIT_VERSION=$(git describe --tags | cut -d'-' -f1)
|
|
echo "App version: ${REL_VERSION}"
|
|
echo "Git version: ${GIT_VERSION}"
|
|
if [ "${APP_VERSION}" != "${GIT_VERSION}" ]; then
|
|
echo "ERROR! Version mismatch.";
|
|
exit 1
|
|
fi
|
|
|
|
draft-release:
|
|
needs: [version-check]
|
|
name: "Draft Release 📥️"
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Create release ${{ github.ref }} as a draft
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh release create "${{ github.ref }}" --draft --generate-notes
|
|
|
|
build-release:
|
|
needs: [draft-release]
|
|
name: "Build Release 👨🔧"
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Build and Upload .deb
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
sudo apt-get -y update
|
|
sudo apt-get -y install debhelper devscripts
|
|
REL_VER=$(grep "^readonly VERSION" quickemu | cut -d'"' -f2)
|
|
rm debian/changelog
|
|
dch --package quickemu --newversion="${REL_VER}-1" --distribution=unstable "New upstream release." --create
|
|
dpkg-buildpackage --build=binary --no-check-builddeps --compression=gzip
|
|
gh release upload "${{ github.ref }}" "../quickemu_${REL_VER}-1_all.deb" --clobber
|
|
|
|
publish-release:
|
|
needs: [build-release]
|
|
name: "Publish Release 📤️"
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Publish release ${{ github.ref }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
if [ "$(gh release view "${{ github.ref }}" --json assets --template '{{len .assets}}')" -lt 0 ]; then
|
|
exit 1
|
|
fi
|
|
gh release edit "${{ github.ref }}" --draft=false
|
|
|
|
publish-flakehub:
|
|
needs: [version-check]
|
|
name: "Publish FlakeHub ❄️"
|
|
runs-on: "ubuntu-22.04"
|
|
permissions:
|
|
id-token: "write"
|
|
contents: "read"
|
|
steps:
|
|
- uses: "actions/checkout@v4"
|
|
with:
|
|
ref: "${{ (inputs.tag != null) && format('refs/tags/{0}', inputs.tag) || '' }}"
|
|
- uses: "DeterminateSystems/nix-installer-action@main"
|
|
- uses: "DeterminateSystems/magic-nix-cache-action@main"
|
|
- uses: "DeterminateSystems/flakehub-push@main"
|
|
with:
|
|
visibility: "public"
|
|
name: "quickemu-project/quickemu"
|
|
tag: "${{ inputs.tag }}"
|
|
|
|
publish-ppa:
|
|
needs: [version-check]
|
|
name: "Publish PPA 📦️"
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: "Checkout 🥡"
|
|
uses: actions/checkout@v4
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: "Import gpg key 🔑"
|
|
uses: crazy-max/ghaction-import-gpg@v6
|
|
with:
|
|
gpg_private_key: ${{ secrets.PPA_GPG_PRIVATE_KEY }}
|
|
passphrase: ${{ secrets.PPA_GPG_PASSPHRASE }}
|
|
- name: "Install dependencies 💾"
|
|
run: |
|
|
sudo apt-get -y update
|
|
sudo apt-get -y install debhelper-compat distro-info dput devscripts
|
|
- name: "Upload to PPA ⤴️"
|
|
env:
|
|
DEBEMAIL: ${{ secrets.DEBEMAIL }}
|
|
DEBFULLNAME: ${{ secrets.DEBFULLNAME }}
|
|
run: |
|
|
REL_VER=$(grep "^readonly VERSION" quickemu | cut -d'"' -f2)
|
|
STAMP=$(date +%y%j.%H%M)
|
|
for CODENAME in $(distro-info --supported); do
|
|
rm debian/changelog
|
|
dch --package quickemu --newversion="${REL_VER}-1~${CODENAME}${STAMP}" --distribution=${CODENAME} "New upstream release." --create
|
|
dpkg-buildpackage -d -S -sa
|
|
dput ppa:flexiondotorg/quickemu ../quickemu_${REL_VER}-1~${CODENAME}${STAMP}_source.changes
|
|
done
|