Update alpha-release.yml #384
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' }} | |
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: | |
if: ${{ github.repository == 'homebridge/homebridge-config-ui-x' }} | |
name: "Pre Release Alpha" | |
needs: publish | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Get latest alpha tag from npm | |
id: get_npm_version | |
run: echo "version=$(npm show homebridge-config-ui-x@alpha version)" >> $GITHUB_OUTPUT | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: v${{ steps.get_npm_version.outputs.version }} | |
prerelease: true | |
delete-alpha-tag: | |
if: ${{ github.repository == 'homebridge/homebridge-config-ui-x' }} | |
name: pre-release-alpha | |
needs: [publish, pre-release-alpha] | |
runs-on: ubuntu-latest | |
steps: | |
- 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: Calculate previous alpha tag | |
id: calculate_previous_alpha_tag | |
run: echo "previous_alpha_tag=$(echo ${{ steps.get_npm_version.outputs.version }} >> $GITHUB_OUTPUT | sed 's/alpha/alpha-1/')" | |
- name: Delete alpha release ${{ steps.calculate_previous_alpha_tag.outputs.previous_alpha_tag }} | |
uses: liudonghua123/delete-release-action@v1 | |
with: | |
release_name: contains(${{ steps.calculate_previous_alpha_tag.outputs.previous_alpha_tag }}, 'alpha') | |
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_LATEST: ${{ secrets.DISCORD_WEBHOOK_URL_BETA }} | |
DISCORD_WEBHOOK_URL_BETA: ${{ secrets.DISCORD_WEBHOOK_URL_BETA }} |