10000 BETA: Bump homebridge-config-ui-x in /beta (#93) · homebridge/homebridge-apt-pkg@265a0a9 · GitHub
[go: up one dir, main page]

Skip to content

Beta Stage 2 - Build and Release Beta Package #44

Beta Stage 2 - Build and Release Beta Package

Beta Stage 2 - Build and Release Beta Package #44

name: Beta Stage 2 - Build and Release Beta Package
permissions:
contents: write
actions: write
id-token: write
on:
pull_request:
types: [closed]
workflow_dispatch:
jobs:
check-changes:
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log event context for debugging
if: github.event_name == 'pull_request'
run: |
echo "Event: ${{ github.event_name }}"
echo "Merged: ${{ github.event.pull_reque F7F0 st.merged }}"
- name: Verify beta-only changes
if: github.event_name == 'pull_request'
run: |
changed_files=$(git diff --name-only HEAD^ HEAD)
for file in $changed_files; do
if [[ ! $file == beta/* ]]; then
echo "Non-beta changes detected in $file. Exiting."
exit 1
fi
done
generate_beta_version:
needs: check-changes
name: Generate Beta Package Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.beta_version.outputs.version }}
npm_version: ${{ steps.beta_version.outputs.npm_version }}
steps:
- uses: actions/checkout@v4
- name: Get base version
uses: reecetech/version-increment@2023.10.1
id: release_version
with:
scheme: semver
increment: patch
- name: Generate beta package version
id: beta_version
run: |
BASE_VERSION=${{ steps.release_version.outputs.version }}
BASE_VERSION_CLEAN=$(echo "$BASE_VERSION" | sed -E 's/-[a-z0-9.]+//')
DATE=$(date +%Y%m%d)
VERSION="${BASE_VERSION_CLEAN}~beta.${DATE}"
NPM_VERSION="${BASE_VERSION_CLEAN}-beta.${DATE}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "npm_version=$NPM_VERSION" >> $GITHUB_OUTPUT
echo "::notice::📦 Beta version: $VERSION"
build_beta_and_store:
name: Build Beta Packages for (${{ matrix.name }})
needs: [generate_beta_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/raspberrypi3-debian:bullseye
QEMU_ARCH: arm
- name: debian-arm64v8
os: ubuntu-latest
BASE_IMAGE: arm64v8/debian:bullseye
QEMU_ARCH: aarch64
steps:
- uses: actions/checkout@v4
- name: Setup build environment
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
continue-on-error: false
- name: Build Docker image
run: |
docker build -f build/Dockerfile \
--build-arg BASE_IMAGE=${{ matrix.BASE_IMAGE }} \
--build-arg QEMU_ARCH=${{ matrix.QEMU_ARCH }} \
-t beta-package-build \
--platform=linux/${{ matrix.QEMU_ARCH }} \
--cache-from=beta-package-build:latest \
--build-arg BUILDKIT_INLINE_CACHE=1 .
continue-on-error: false
- name: Build package
run: |
docker run --rm -v $(pwd):/repo \
-e PKG_RELEASE_TYPE="beta" \
-e PKG_RELEASE_VERSION="${{ needs.generate_beta_version.outputs.version }}" \
beta-package-build
continue-on-error: false
- name: Rename package to include v
run: |
DEB_FILE=$(ls homebridge*.deb 2>/dev/null || echo "")
if [ -z "$DEB_FILE" ]; then
echo "No .deb file found. Exiting."
exit 1
fi
UPDATED=$(echo "$DEB_FILE" | sed -e 's/homebridge_/homebridge_v/g')
mv "$DEB_FILE" "$UPDATED"
- name: Rename manifest to include v
run: |
MANIFEST_FILE=$(ls homebridge*.manifest 2>/dev/null || echo "")
if [ -z "$MANIFEST_FILE" ]; then
echo "No .manifest file found. Exiting."
exit 1
fi
UPDATED=$(echo "$MANIFEST_FILE" | sed -e 's/homebridge_/homebridge_v/g')
mv "$MANIFEST_FILE" "$UPDATED"
- uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.name }}
retention-days: 7
path: |
homebridge_v*.deb
homebridge_v*.manifest
publish_apt_beta:
name: APT Beta Repo Publish ${{ needs.generate_beta_version.outputs.version }}
runs-on: ubuntu-latest
needs: [generate_beta_version, build_beta_and_store]
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: artifacts-*
merge-multiple: true
path: repo/
- name: Display structure of downloaded files
run: ls -R
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v6
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.8/deb-s3-0.11.8.gem
sudo gem install deb-s3-0.11.8.gem
- name: Upload to Beta APT Repo
run: |
sudo chown -R $USER: repo/
deb-s3 upload \
--codename=beta \
--suite=beta \
--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/homebridge_v*.deb
publish_github_beta_release:
name: Publish GitHub Beta Release v${{ needs.generate_beta_version.outputs.npm_version }}
needs: [publish_apt_beta, generate_beta_version]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: artifacts-*
merge-multiple: true
path: artifacts/
- name: Read amd64 manifest content
id: read_manifest
run: |
echo "MANIFEST_FILE=$(ls artifacts/*.manifest | head -n 1)" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.generate_beta_version.outputs.npm_version }}
name: Beta Release v${{ needs.generate_beta_version.outputs.npm_version }}
prerelease: true
files: |
artifacts/homebridge_v*.deb
artifacts/homebridge_v*.manifest
body_path: ${{ steps.read_manifest.outputs.MANIFEST_FILE }}
body: |
Homebridge Apt Package Manifest
Release Version: v${{ needs.generate_beta_version.outputs.npm_version }}
Release Type: beta
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
purge_cloudflare_cache:
name: Purge Cloudflare Cache
needs: publish_apt_beta
uses: ./.github/workflows/stage-3_5_purge_cloudflare_cache.yml
secrets:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
publish_to_npm:
needs: [generate_beta_version, build_beta_and_store]
name: NPM Publish ${{ needs.generate_beta_version.outputs.npm_version }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: latest
registry-url: 'https://registry.npmjs.org'
- name: Set package.json version
run: |
BETA_VERSION="${{ needs.generate_beta_version.outputs.npm_version }}"
echo "Setting version to $BETA_VERSION"
jq ".version = \"$BETA_VERSION\"" package.json > tmp.$$.json && mv tmp.$$.json package.json
cat package.json
- name: Publish to npm with beta tag
run: npm publish --access public --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Output Success Notice
run: echo "::notice::Published @homebridge/homebridge-apt-pkg as version ${{ needs.generate_beta_version.outputs.npm_version }} with beta tag"
0