Build Release 1.1.1 from latest #79
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.event.inputs.version }} from ${{ github.ref_name }} | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version / Tag (x.x.x):' | |
required: true | |
release_type: | |
type: choice | |
description: Release Type | |
options: | |
- stable | |
- test | |
jobs: | |
release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.version }} | |
release_name: ${{ github.event.inputs.version }} | |
prerelease: false | |
build: | |
name: Build Packages | |
needs: release | |
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="${{ github.event.inputs.release_type }}" -e PKG_RELEASE_VERSION="${{ github.event.inputs.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: ${{ github.event.inputs.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: ${{ github.event.inputs.version }} | |
with: | |
body_path: ${{ env.BODY_FILE }} | |
- uses: AButler/[email protected] | |
with: | |
files: '*.deb;*.manifest' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-tag: ${{ github.event.inputs.version }} | |
update-apt-repo: | |
name: Publish to Repo | |
needs: 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: ${{ github.event.inputs.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=${{ github.event.inputs.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 }} |