Skip to content

Attach Artifacts

Attach Artifacts #4

name: Attach Artifacts
run-name: Attach Artifacts
on:
release:
types: [prereleased]
workflow_dispatch:
inputs:
tag:
description: 'Tag - must not start with v'
required: true
jobs:
build:
name: Attach Artifact
runs-on: ubuntu-latest
steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install package ${{ github.event.inputs.tag }}
if: github.event_name == 'workflow_dispatch'
run: |
export npm_config_prefix=$(pwd)/package
npm install -g homebridge-config-ui-x@${{ github.event.inputs.tag }}
- name: Remove invalid node-pty node-gyp run ${{ github.event.inputs.tag }}
if: github.event_name == 'workflow_dispatch'
run: |
rm -rf $(pwd)/package/lib/node_modules/homebridge-config-ui-x/node_modules/@homebridge/node-pty-prebuilt-multiarch/build
- name: Create Bundle ${{ github.event.inputs.tag }}
if: github.event_name == 'workflow_dispatch'
run: |
tar -C $(pwd)/package --owner=0 --group=0 --format=posix -czvf homebridge-config-ui-x-${{ github.event.inputs.tag }}.tar.gz .
shasum -a 256 homebridge-config-ui-x-${{ github.event.inputs.tag }}.tar.gz > SHASUMS256.txt
- name: Check Bundle ${{ github.event.inputs.tag }}
if: github.event_name == 'workflow_dispatch'
run: |
if [ $(stat -c%s "homebridge-config-ui-x-${{ github.event.inputs.tag }}.tar.gz") -lt 10000000 ]; then
echo "Bundle is under 10MB, stopping"
exit 1
fi
- name: Upload tar.gz Bundle to GitHub Artifacts ${{ github.event.inputs.tag }}
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: 'homebridge-config-ui-x-${{ github.event.inputs.tag }}.tar.gz'
path: |
./homebridge-config-ui-x-${{ github.event.inputs.tag }}.tar.gz
- name: Upload SHASUMS256.txt to GitHub Artifacts ${{ github.event.inputs.tag }}
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: 'SHASUMS256.txt'
path: |
./SHASUMS256.txt
- name: Attach Bundle ${{ github.event.inputs.tag }}
if: github.event_name == 'workflow_dispatch'
uses: AButler/[email protected]
with:
files: 'homebridge-config-ui-x-${{ github.event.inputs.tag }}.tar.gz;SHASUMS256.txt'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ github.event.inputs.tag }}
# github.ref
- name: Get version from ${{ github.event_name }} tag
if: github.event_name == 'release'
id: get_version
uses: jannemattila/get-version-from-tag@v3
- name: Install package v${{ steps.get_version.outputs.version }}
if: github.event_name == 'release'
run: |
export npm_config_prefix=$(pwd)/package
npm install -g homebridge-config-ui-x@${{ steps.get_version.outputs.version }}
- name: Remove invalid node-pty node-gyp run v${{ steps.get_version.outputs.version }}
if: github.event_name == 'release'
run: |
rm -rf $(pwd)/package/lib/node_modules/homebridge-config-ui-x/node_modules/@homebridge/node-pty-prebuilt-multiarch/build
- name: Create Bundle v${{ steps.get_version.outputs.version }}
if: github.event_name == 'release'
run: |
tar -C $(pwd)/package --owner=0 --group=0 --format=posix -czvf homebridge-config-ui-x-${{ steps.get_version.outputs.version }}.tar.gz .
shasum -a 256 homebridge-config-ui-x-${{ steps.get_version.outputs.version }}.tar.gz > SHASUMS256.txt
- name: Check Bundle v${{ steps.get_version.outputs.version }}
if: github.event_name == 'release'
run: |
if [ $(stat -c%s "homebridge-config-ui-x-${{ steps.get_version.outputs.version }}.tar.gz") -lt 10000000 ]; then
echo "Bundle is under 10MB, stopping"
exit 1
fi
- name: Upload tar.gz Bundle to GitHub Artifacts v${{ steps.get_version.outputs.version }}
if: github.event_name == 'release'
uses: actions/upload-artifact@v4
with:
name: 'homebridge-config-ui-x-${{ steps.get_version.outputs.version }}.tar.gz'
path: |
./homebridge-config-ui-x-${{ steps.get_version.outputs.version }}.tar.gz
- name: Upload SHASUMS256.txt to GitHub Artifacts v${{ steps.get_version.outputs.version }}
if: github.event_name == 'release'
uses: actions/upload-artifact@v4
with:
name: 'SHASUMS256.txt'
path: |
./SHASUMS256.txt
- name: Attach Bundle v${{ steps.get_version.outputs.version }}
if: github.event_name == 'release'
uses: AButler/[email protected]
with:
files: 'homebridge-config-ui-x-${{ steps.get_version.outputs.version }}.tar.gz;SHASUMS256.txt'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: v${{ steps.get_version.outputs.version }}
github-releases-to-discord:
name: Discord Webhooks
needs: build
uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest
with:
footer_title: "Pre-Release: Homebridge UI"
secrets:
DISCORD_WEBHOOK_URL_BETA: ${{ secrets.DISCORD_WEBHOOK_URL_BETA }}