Skip to content

Commit

Permalink
Refactor GitHub Action Workflows (#1487)
Browse files Browse the repository at this point in the history
* Unify build and test workflows

* Fix matrix.os variable in build workflow

* Add github release drafter template

* Fix runs_on input and add test-coverage script

* Fix hb_service installation; override install command for build_and_test job

* Disable coverage reporting for now and install dev dependency in build step

* Upgrade jest to run code coverage

* Supply install_cmd on lint job

* Include release workflow in GitHub Actions

* Remove needs requirements for lint job

* modified:   .github/workflows/build.yml

---------

Co-authored-by: Donavan Becker <donavan.becker@icloud.com>
  • Loading branch information
Supereg and donavanbecker authored May 10, 2023
1 parent 520a243 commit 1429765
Show file tree
Hide file tree
Showing 12 changed files with 1,286 additions and 1,126 deletions.
21 changes: 21 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The GitHub release configuration file: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes

changelog:
categories:
- title: Breaking Changes 🛠
labels:
- 'breaking change'
- title: Featured Changes ✨
labels:
- 'feature'
- 'enhancement'
- title: Bug Fixes 🐛
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: Other Changes
labels:
- "chore"
- "housekeeping"
- "*"
38 changes: 38 additions & 0 deletions .github/workflows/attach-artifact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Attach Artifacts

on:
release:
types: [published]

jobs:
build:
name: Attach Artifact
runs-on: ubuntu-latest

steps:
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 16.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: Check for Tag name Format
if: startWith(${{github.event.release.tag_name}}, 'v')
run: |
echo "Tag name must not start with 'v' Prefix"
exit 1
- name: Install package
run: |
export npm_config_prefix=$(pwd)/package
npm install -g homebridge-config-ui-x@${{ github.event.release.tag_name }}
- 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
- name: Attach Bundle
uses: AButler/upload-release-assets@v2.0
with:
files: 'homebridge-config-ui-x-${{ github.event.release.tag_name }}.tar.gz;SHASUMS256.txt'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ github.event.release.tag_name }}
7 changes: 6 additions & 1 deletion .github/workflows/beta-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ jobs:
uses: homebridge/.github/.github/workflows/nodejs-build-and-test.yml@main
with:
enable_coverage: true
install_cmd: npm ci && cd ui && npm ci
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

lint:
needs: build_and_test
uses: homebridge/.github/.github/workflows/eslint.yml@main
with:
install_cmd: npm ci && cd ui && npm ci

publish:
needs: lint
Expand All @@ -26,6 +30,7 @@ jobs:
tag: 'test'
dynamically_adjust_version: true
npm_version_command: 'pre'
pre_id: 'beta'
pre_id: 'test'
install_cmd: npm ci && cd ui && npm ci
secrets:
npm_auth_token: ${{ secrets.npm_token }}
12 changes: 12 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: PR Labeler

on:
pull_request: # required for auto labeler
types: [opened, reopened, synchronize]
workflow_dispatch:

jobs:
stale:
uses: homebridge/.github/.github/workflows/pr-labeler.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
58 changes: 0 additions & 58 deletions .github/workflows/publish.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/release-drafter.ym

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ jobs:
if: ${{ github.repository == 'homebridge/homebridge-config-ui-x' }}

uses: homebridge/.github/.github/workflows/npm-publish.yml@main
with:
install_cmd: npm ci && cd ui && npm ci
secrets:
npm_auth_token: ${{ secrets.npm_token }}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tag-version-prefix=""
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ You should now be able to navigate to `https://localhost:4200` in your browser w
If you have made changes to the server side code, you should run the e2e test suite before creating a pull request:

```
npm run test:e2e
npm run test
```

## Contributing To Translations
Expand Down
Loading

0 comments on commit 1429765

Please sign in to comment.