Skip to content

Commit

Permalink
Fix Attach Artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Dec 8, 2023
1 parent f63405f commit 487f29c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
23 changes: 11 additions & 12 deletions .github/workflows/Attach Artifacts.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Attach Artifacts from Node Release or Manually ( If the automation fails )
run-name: From Node Release or Manually Attach Artifacts against ${{ github.event.inputs.tag }}
name: Attach Artifacts Manually ( If the automation fails )
run-name: Manually Attach Artifacts against ${{ github.event.inputs.tag }}

on:
repository_dispatch:
Expand All @@ -21,10 +21,9 @@ jobs:
with:
node-version: 20.x

- name: Get previous tag
if: github.event.inputs.tag == ''
id: previoustag
uses: 'WyriHaximus/github-action-get-previous-tag@v1'
- name: Tag
id: tag
uses: JinoArch/get-latest-tag@latest

# Sanity check to ensure that release tags don't start with a 'v' version prefix but adhere to the X.Y.Z format
- name: Check for Tag name Format
Expand All @@ -37,27 +36,27 @@ jobs:
- name: Install package
run: |
export npm_config_prefix=$(pwd)/package
npm install -g homebridge-config-ui-x@${{ needs.analyze-tags.outputs.previous-tag || github.event.inputs.tag }}
npm install -g homebridge-config-ui-x@${{ steps.tag.outputs.latestTag || github.event.inputs.tag }}
- 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.analyze-tags.outputs.previous-tag || github.event.inputs.tag }}.tar.gz .
shasum -a 256 homebridge-config-ui-x-${{ needs.analyze-tags.outputs.previous-tag || github.event.inputs.tag }}.tar.gz > SHASUMS256.txt
tar -C $(pwd)/package --owner=0 --group=0 --format=posix -czvf homebridge-config-ui-x-${{ steps.tag.outputs.latestTag || github.event.inputs.tag }}.tar.gz .
shasum -a 256 homebridge-config-ui-x-${{ steps.tag.outputs.latestTag || github.event.inputs.tag }}.tar.gz > SHASUMS256.txt
- name: Check Bundle
run: |
if [ $(stat -c%s "homebridge-config-ui-x-${{ needs.analyze-tags.outputs.previous-tag || github.event.inputs.tag }}.tar.gz") -lt 10000000 ]; then
if [ $(stat -c%s "homebridge-config-ui-x-${{ steps.tag.outputs.latestTag || github.event.inputs.tag }}.tar.gz") -lt 10000000 ]; then
echo "Bundle is under 10MB, stopping"
exit 1
fi
- name: Attach Bundle
uses: AButler/upload-release-assets@v2.0
with:
files: 'homebridge-config-ui-x-${{ needs.analyze-tags.outputs.previous-tag || github.event.inputs.tag }}.tar.gz;SHASUMS256.txt'
files: 'homebridge-config-ui-x-${{ steps.tag.outputs.latestTag || github.event.inputs.tag }}.tar.gz;SHASUMS256.txt'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ github.event.inputs.tag }}
release-tag: ${{ steps.tag.outputs.latestTag || github.event.inputs.tag }}
28 changes: 17 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Node Release
run-name: Production Release ${{ github.event.release.tag_name }}
run-name: Production Release

on:
# Removed publish on push, and forced manual release from github
Expand Down Expand Up @@ -39,36 +39,42 @@ jobs:
with:
node-version: 20.x

# Sanity check to ensure that release tags don't start with a 'v' version prefix but adhere to the X.Y.Z format
- name: Tag
id: tag
uses: JinoArch/get-latest-tag@latest

# Sanity check to ensure that release tags don't start with a 'v' version prefix but adhere to the X.Y.Z format
- name: Check for Tag name Format
# https://github.com/orgs/community/discussions/25017
if: startsWith(github.event.release.tag_name, 'v')
if: startsWith(steps.tag.outputs.latestTag, 'v')
run: |
echo "Release Tag name must not start with 'v', this was supplied ${{github.event.release.tag_name}}"
echo "Release Tag name must not start with 'v', this was supplied ${{steps.tag.outputs.latestTag}}"
exit 1
- name: Install package
run: |
export npm_config_prefix=$(pwd)/package
npm install -g homebridge-config-ui-x@${{ github.event.release.tag_name }}
npm install -g homebridge-config-ui-x@${{ steps.tag.outputs.latestTag }}
- 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-${{ github.event.release.tag_name }}.tar.gz .
shasum -a 256 homebridge-config-ui-x-${{ github.event.release.tag_name }}.tar.gz > SHASUMS256.txt
tar -C $(pwd)/package --owner=0 --group=0 --format=posix -czvf homebridge-config-ui-x-${{ steps.tag.outputs.latestTag }}.tar.gz .
shasum -a 256 homebridge-config-ui-x-${{ steps.tag.outputs.latestTag }}.tar.gz > SHASUMS256.txt
- name: Check Bundle
run: |
if [ $(stat -c%s "homebridge-config-ui-x-${{ github.event.release.tag_name }}.tar.gz") -lt 10000000 ]; then
if [ $(stat -c%s "homebridge-config-ui-x-${{ steps.tag.outputs.latestTag }}.tar.gz") -lt 10000000 ]; then
echo "Bundle is under 10MB, stopping"
exit 1
fi
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
- name: Attach Bundle
uses: AButler/upload-release-assets@v2.0
with:
event-type: attach-artifacts
files: 'homebridge-config-ui-x-${{ steps.tag.outputs.latestTag }}.tar.gz;SHASUMS256.txt'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ steps.tag.outputs.latestTag }}

0 comments on commit 487f29c

Please sign in to comment.