-
Notifications
You must be signed in to change notification settings - Fork 383
118 lines (103 loc) · 4.01 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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 }}