Skip to content

Production Release

Production Release #47

Workflow file for this run

name: Node Release
run-name: Production Release
on:
release:
types: [released]
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
build_and_test:
needs: tag
name: Build and Test ${{ needs.tag.outputs.version }}
if: ${{ github.repository == 'homebridge/homebridge-config-ui-x' }}
uses: homebridge/.github/.github/workflows/nodejs-build-and-test.yml@latest
with:
enable_coverage: true
install_cmd: npm ci && cd ui && npm ci
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
publish:
needs: [tag, build_and_test]
name: Publish ${{ needs.tag.outputs.version }}
if: ${{ github.repository == 'homebridge/homebridge-config-ui-x' }}
uses: homebridge/.github/.github/workflows/npm-publish.yml@latest
with:
install_cmd: npm ci && cd ui && npm ci
secrets:
npm_auth_token: ${{ secrets.npm_token }}
attach-artifact:
needs: [tag, publish]
if: ${{ github.repository == 'homebridge/homebridge-config-ui-x' }}
name: Attach Artifact ${{ needs.tag.outputs.version }}
runs-on: ubuntu-latest
steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install package
run: |
export npm_config_prefix=$(pwd)/package
npm install -g homebridge-config-ui-x@${{ needs.tag.outputs.version }}
- name: Remove invalid node-pty node-gyp run
run: |
rm -rf $(pwd)/package/lib/node_modules/homebridge-config-ui-x/node_modules/@homebridge/node-pty-prebuilt-multiarch/build
- name: Create Bundle
run: |
tar -C $(pwd)/package --owner=0 --group=0 --format=posix -czvf homebridge-config-ui-x-${{ needs.tag.outputs.version }}.tar.gz .
shasum -a 256 homebridge-config-ui-x-${{ needs.tag.outputs.version }}.tar.gz > SHASUMS256.txt
- name: Check Bundle
run: |
if [ $(stat -c%s "homebridge-config-ui-x-${{ needs.tag.outputs.version }}.tar.gz") -lt 10000000 ]; then
echo "Bundle is under 10MB, stopping"
exit 1
fi
- name: Upload tar.gz Bundle to GitHub Artifacts
uses: actions/upload-artifact@v4
with:
name: 'homebridge-config-ui-x-${{ needs.tag.outputs.version }}.tar.gz'
path: |
./homebridge-config-ui-x-${{ needs.tag.outputs.version }}.tar.gz
- name: Upload SHASUMS256.txt to GitHub Artifacts
uses: actions/upload-artifact@v4
with:
name: SHASUMS256.txt
path: |
./SHASUMS256.txt
- name: Attach Bundle
uses: AButler/upload-release-assets@v3.0
with:
files: 'homebridge-config-ui-x-${{ needs.tag.outputs.version }}.tar.gz;SHASUMS256.txt'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: v${{ needs.tag.outputs.version }}
github-releases-to-discord:
name: Discord Webhooks
needs: [tag, build_and_test, publish, attach-artifact]
uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest
with:
title: Homebridge UI Release
description: |
Version `v${{ needs.publish.outputs.NPM_VERSION }}`
url: 'https://github.com/homebridge/homebridge-config-ui-x/releases/tag/v${{ needs.publish.outputs.NPM_VERSION }}'
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL_LATEST }}