From 7c892c9dc2f50d1516af3cf9e1c0503b997f2ebe Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Fri, 3 May 2024 11:00:00 +0100 Subject: [PATCH] ci: refactor publish-release.yml All release operations in a single workflow --- .github/workflows/publish-flakehub.yml | 28 ----------- .github/workflows/publish-ppa.yml | 36 -------------- .github/workflows/publish-release.yml | 68 +++++++++++++++++++++++--- 3 files changed, 62 insertions(+), 70 deletions(-) delete mode 100644 .github/workflows/publish-flakehub.yml delete mode 100644 .github/workflows/publish-ppa.yml diff --git a/.github/workflows/publish-flakehub.yml b/.github/workflows/publish-flakehub.yml deleted file mode 100644 index 3205a08..0000000 --- a/.github/workflows/publish-flakehub.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: "Publish FlakeHub โ„๏ธ" -on: - push: - tags: - - "v?[0-9]+.[0-9]+.[0-9]+*" - workflow_dispatch: - inputs: - tag: - description: "The existing tag to publish to FlakeHub" - type: "string" - required: true -jobs: - flakehub-publish: - runs-on: "ubuntu-22.04" - permissions: - id-token: "write" - contents: "read" - steps: - - uses: "actions/checkout@v3" - 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 }}" diff --git a/.github/workflows/publish-ppa.yml b/.github/workflows/publish-ppa.yml deleted file mode 100644 index 87e2a8d..0000000 --- a/.github/workflows/publish-ppa.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Publish PPA ๐Ÿ“ฆ๏ธ - -on: - workflow_dispatch: - -jobs: - publish-ppa: - 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: Publish 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 diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 15902b0..8947f26 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -2,11 +2,18 @@ name: Publish Release ๐Ÿท๏ธ on: push: - tags: ['*'] + tags: + - "v?[0-9]+.[0-9]+.[0-9]+*" + workflow_dispatch: + inputs: + tag: + description: "The existing tag to publish" + type: "string" + required: true jobs: - create-release: - name: Create Release + draft-release: + name: "Draft Release ๐Ÿ“ฅ๏ธ" runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -17,8 +24,8 @@ jobs: gh release create "${{ github.ref }}" --draft --generate-notes build-release: - needs: [create-release] - name: Build Release + needs: [draft-release] + name: "Build Release ๐Ÿ‘จโ€๐Ÿ”ง" runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -36,7 +43,7 @@ jobs: publish-release: needs: [build-release] - name: Publish Release + name: "Publish Release ๐Ÿ“ค๏ธ" runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -48,3 +55,52 @@ jobs: exit 1 fi gh release edit "${{ github.ref }}" --draft=false + + publish-flakehub: + 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: + 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