Build Release refs/tags/v1.3.0 from v1.3.0 #88
Workflow file for this run
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: "Build Release and Publish to DEB Repo" | |
run-name: Build Release ${{ github.ref }} from ${{ github.ref_name }} | |
on: | |
release: | |
types: [released, prereleased] | |
jobs: | |
tag: | |
name: Verify Release Tag | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get_version.outputs.version }} | |
steps: | |
- name: Get Release Tag | |
id: get_version | |
uses: jannemattila/get-version-from-tag@v3 | |
- name: Tag Info | |
run: | | |
echo "Release Tag: ${{github.ref}}" | |
echo "Latest Tag: ${{ steps.get_version.outputs.version }}" | |
- name: Tag Info Matches | |
if: endsWith(github.ref, steps.get_version.outputs.version ) | |
run: | | |
echo Latest Tag matches Release tag | |
- name: Tag Info Doesn't Match | |
if: ${{ !endsWith(github.ref, steps.get_version.outputs.version ) }} | |
run: | | |
echo Latest Tag does not matches Release tag | |
exit 1 | |
release_type: | |
name: Release Type | |
needs: tag | |
runs-on: ubuntu-latest | |
outputs: | |
release_type: ${{ steps.stable_release.outputs.release_type || steps.test_release.outputs.release_type }} | |
steps: | |
- name: Release Type - stable | |
id: stable_release | |
if: ${{ github.event.release.prerelease == false }} | |
run: | | |
echo "release_type=stable" >> "$GITHUB_OUTPUT" | |
- name: Release Type - test | |
id: test_release | |
if: ${{ github.event.release.prerelease == true }} | |
run: | | |
echo "release_type=test" >> "$GITHUB_OUTPUT" | |
build: | |
needs: [tag, release_type] | |
name: Build Packages for (${{ matrix.name }}) v${{ needs.tag.outputs.version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
name: [ | |
debian-x86_64, | |
debian-arm32v6, | |
debian-arm64v8, | |
] | |
include: | |
- name: debian-x86_64 | |
os: ubuntu-latest | |
BASE_IMAGE: library/debian:bullseye | |
QEMU_ARCH: x86_64 | |
- name: debian-arm32v6 | |
os: ubuntu-latest | |
BASE_IMAGE: balenalib/raspberry-pi-debian:bullseye | |
QEMU_ARCH: arm | |
- name: debian-arm64v8 | |
os: ubuntu-latest | |
BASE_IMAGE: arm64v8/debian:bullseye | |
QEMU_ARCH: aarch64 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Linux - Setup Dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get --yes --no-install-recommends install binfmt-support qemu-user-static | |
docker run --rm --privileged multiarch/qemu-user-static:register --reset | |
- name: Linux - Build Docker Image | |
if: runner.os == 'Linux' | |
run: | | |
docker build -f build/Dockerfile --build-arg BASE_IMAGE=${{ matrix.BASE_IMAGE }} --build-arg QEMU_ARCH=${{ matrix.QEMU_ARCH }} -t package-build . | |
- name: Linux - Build Package | |
if: runner.os == 'Linux' | |
run: | | |
docker run --rm -v $(pwd):/repo -e PKG_RELEASE_TYPE="${{ needs.release_type.outputs.release_type }}" -e PKG_RELEASE_VERSION="${{ needs.tag.outputs.version }}" package-build | |
- name: Set variables | |
run: | | |
echo BODY_FILE="$(ls *.manifest)" >> $GITHUB_ENV | |
- name: update release | |
uses: tubone24/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAG_NAME: ${{ needs.tag.outputs.version }} | |
with: | |
is_append_body: "Contents of ${{ matrix.QEMU_ARCH }} Package." | |
- name: update release | |
uses: tubone24/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAG_NAME: ${{ needs.tag.outputs.version }} | |
with: | |
body_path: ${{ env.BODY_FILE }} | |
- uses: AButler/[email protected] | |
with: | |
files: '*.deb;*.manifest' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-tag: ${{ needs.tag.outputs.version }} | |
update-apt-repo: | |
name: Publish to Repo | |
needs: [tag, release_type, build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get the release | |
id: get_release | |
uses: cardinalby/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
tag: ${{ needs.tag.outputs.version }} | |
- name: Download release assets | |
uses: dsaltares/[email protected] | |
with: | |
version: ${{ steps.get_release.outputs.id }} | |
regex: true | |
file: "homebridge.*\\.deb" | |
target: "repo/" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v4 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Install deb-s3 | |
run: | | |
curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.3/deb-s3-0.11.3.gem | |
sudo gem install deb-s3-0.11.3.gem | |
- name: Update Repo | |
run: | | |
sudo chown -R $USER: repo/ | |
deb-s3 upload \ | |
--codename=${{ needs.release_type.outputs.release_type }} \ | |
--preserve-versions \ | |
--s3-region=us-west-2 \ | |
--bucket repo.homebridge.io \ | |
--access-key-id=${{ secrets.AWS_ACCESS_KEY_ID }} \ | |
--secret-access-key=${{ secrets.AWS_SECRET_ACCESS_KEY }} \ | |
--sign=${{ secrets.GPG_KEY_ID }} \ | |
repo/*.deb | |
purge_cloudflare_cache: | |
name: Clear Cache | |
needs: update-apt-repo | |
uses: ./.github/workflows/purge-cf-cache.yml | |
secrets: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} | |
github-releases-to-discord: | |
name: Discord Webhooks | |
needs: [tag,release_type,build,update-apt-repo,purge_cloudflare_cache] | |
uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest | |
with: | |
title: "Homebridge APT Package Release" | |
description: | | |
Version `${{ needs.tag.outputs.version }}` | |
url: "https://github.com/homebridge/homebridge-apt-pkg/releases/tag/${{ needs.tag.outputs.version }}" | |
secrets: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL_LATEST }} |