Skip to content

Stage 3 - Promote Release Package to APT Stores #7

Stage 3 - Promote Release Package to APT Stores

Stage 3 - Promote Release Package to APT Stores #7

name: "Stage 3 - Promote Release Package to APT Stores"
on:
release:
types: [published, released]
workflow_dispatch:
inputs:
release_tag:
description: "The tag of the release to Package to APT Stores."
required: true
type: string
jobs:
determine_release_tag:
name: Determine Release Tag
runs-on: ubuntu-latest
outputs:
release_tag: ${{ steps.set_release_tag.outputs.release_tag }}
steps:
- name: Set Release Tag
id: set_release_tag
run: |
if [ "${{ github.event_name }}" == "release" ]; then
echo "release_tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
else
echo "release_tag=${{ inputs.release_tag }}" >> "$GITHUB_OUTPUT"
fi
release_type:
name: Determine Release Type
runs-on: ubuntu-latest
needs: determine_release_tag
outputs:
release_type: ${{ steps.release_type.outputs.type }}
steps:
- name: Determine Release Type
id: release_type
run: |
if [ "${{ github.event.release.prerelease }}" == "true" ]; then
echo "type=test" >> "$GITHUB_OUTPUT"
else
echo "type=stable" >> "$GITHUB_OUTPUT"
fi
update_apt_repo:
name: Update APT Repo
runs-on: ubuntu-latest
needs: [determine_release_tag, release_type]
steps:
- uses: actions/checkout@v4
- name: Download Release Assets
uses: robinraju/[email protected]
with:
tag: ${{ needs.determine_release_tag.outputs.release_tag }}
fileName: 'homebridge*.deb'
out-file-path: 'repo/'
- 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.8/deb-s3-0.11.8.gem
sudo gem install deb-s3-0.11.8.gem
- name: Upload Package to APT 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: Purge Cloudflare Cache
needs: update_apt_repo
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 }}
notify_discord:
name: Notify Discord
needs: [update_apt_repo, purge_cloudflare_cache]
uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest
with:
title: "Homebridge APT Package Released"
description: "Version `v${{ needs.determine_release_tag.outputs.release_tag }}` has been released."
url: "https://github.com/homebridge/homebridge-apt-pkg/releases/tag/${{ needs.determine_release_tag.outputs.release_tag }}"
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL_LATEST }}
print_context:
runs-on: ubuntu-latest
steps:
- name: Dump Inputs context
env:
INPUTS_CONTEXT: ${{ toJson(inputs) }}
run: echo "$INPUTS_CONTEXT"
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- name: Show default environment variables
run: |
echo "The job_id is: $GITHUB_JOB" # reference the default environment variables
echo "The id of this action is: $GITHUB_ACTION" # reference the default environment variables
echo "The run id is: $GITHUB_RUN_ID"
echo "The GitHub Actor's username is: $GITHUB_ACTOR"
echo "GitHub SHA: $GITHUB_SHA"