Update alpha-release.yml #387
Workflow file for this run
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: Node-CI Alpha | |
on: | |
push: | |
branches: [alpha-*.*.*, alpha] | |
workflow_dispatch: | |
jobs: | |
publish: | |
if: ${{ github.repository == 'homebridge/homebridge-config-ui-x' }} | |
name: "Publish Pre Release Alpha to NPM" | |
uses: homebridge/.github/.github/workflows/npm-publish.yml@latest | |
with: | |
tag: 'alpha' | |
dynamically_adjust_version: true | |
npm_version_command: 'pre' | |
pre_id: 'alpha' | |
install_cmd: npm ci && cd ui && npm ci | |
secrets: | |
npm_auth_token: ${{ secrets.npm_token }} | |
pre-release-alpha: | |
needs: [publish] | |
if: ${{ github.repository == 'homebridge/homebridge-config-ui-x' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get latest alpha tag from npm | |
id: get_npm_version | |
run: echo "version=$(npm show homebridge-config-ui-x@alpha version)" >> $GITHUB_OUTPUT | |
- name: Create nightly release | |
id: create_release | |
uses: viperproject/create-nightly-release@v1 | |
env: | |
# This token is provided by Actions, you do not need to create your own token | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.get_npm_version.outputs.version }} | |
release_name: v${{ steps.get_npm_version.outputs.version }} | |
body: "[How To Test Upcoming Changes](https://github.com/homebridge/homebridge-config-ui-x/wiki/How-To-Test-Upcoming-Changes)" | |
keep_num: 0 # remove the just created release as well | |
keep_tags: false | |
attach-artifact: | |
name: Attach Artifact | |
needs: [publish, pre-release-alpha] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Get latest alpha tag from npm | |
id: get_npm_version | |
run: echo "version=$(npm show homebridge-config-ui-x@alpha version)" >> $GITHUB_OUTPUT | |
- name: Install package v${{ steps.get_npm_version.outputs.version }} | |
run: | | |
export npm_config_prefix=$(pwd)/package | |
npm install -g homebridge-config-ui-x@${{ steps.get_npm_version.outputs.version }} | |
- name: Remove invalid node-pty node-gyp run v${{ steps.get_npm_version.outputs.version }} | |
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_npm_version.outputs.version }} | |
run: | | |
tar -C $(pwd)/package --owner=0 --group=0 --format=posix -czvf homebridge-config-ui-x-${{ steps.get_npm_version.outputs.version }}.tar.gz . | |
shasum -a 256 homebridge-config-ui-x-${{ steps.get_npm_version.outputs.version }}.tar.gz > SHASUMS256.txt | |
- name: Check Bundle v${{ steps.get_npm_version.outputs.version }} | |
run: | | |
if [ $(stat -c%s "homebridge-config-ui-x-${{ steps.get_npm_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_npm_version.outputs.version }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 'homebridge-config-ui-x-${{ steps.get_npm_version.outputs.version }}.tar.gz' | |
path: | | |
./homebridge-config-ui-x-${{ steps.get_npm_version.outputs.version }}.tar.gz | |
- name: Upload SHASUMS256.txt to GitHub Artifacts v${{ steps.get_npm_version.outputs.version }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 'SHASUMS256.txt' | |
path: | | |
./SHASUMS256.txt | |
- name: Attach Bundle v${{ steps.get_npm_version.outputs.version }} | |
uses: AButler/upload-release-assets@v3.0 | |
with: | |
files: 'homebridge-config-ui-x-${{ steps.get_npm_version.outputs.version }}.tar.gz;SHASUMS256.txt' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-tag: v${{ steps.get_npm_version.outputs.version }} | |
github-releases-to-discord: | |
name: Discord Webhooks | |
needs: [publish,pre-release-alpha,attach-artifact] | |
uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest | |
with: | |
footer_title: "Homebridge UI Alpha Release" | |
secrets: | |
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL_BETA }} |