Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Label PRs and Update Changelog #159

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: 1
#appendOnly: true
labels:
- label: "bugfix"
title: "(?i).*fix.*"
- label: "bugfix"
branch: "(?i).*fix.*"
- label: "feature"
title: "(?i).*feat.*"
- label: "feature"
branch: "(?i).*feat.*"
- label: "breaking-change"
title: "(?i).*breaking[ -_]change.*"
- label: "breaking-change"
branch: "(?i).*breaking[ -_]change.*"
- label: "github_actions"
title: "(?i).*github[ -_]action.*"
- label: "github_actions"
branch: "(?i).*github[ -_]action.*"
- label: "enhancement"
title: "(?i).*enhance.*"
- label: "enhancement"
branch: "(?i).*enhance.*"
- label: "enhancement"
title: "(?i).*improve.*"
- label: "enhancement"
branch: "(?i).*improve.*"
- label: "chore"
title: "(?i).*chore.*"
- label: "chore"
branch: "(?i).*chore.*"
22 changes: 22 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,25 @@ changelog:
labels:
- ignore-for-release
- dependencies
categories:
- title: ":boom: Breaking Change :boom:"
labels:
- Semver-Major
- breaking-change
- title: ":zap: Enhancements & New Features :zap:"
labels:
- Semver-Minor
- enhancement
- feature
- title: ":bug: Bug Fixes :bug:"
labels:
- fix
- bugfix
- bug
- title: ":wrench: Maintenance :wrench:"
labels:
- chore
- github_actions
- title: Other Changes
labels:
- "*"
16 changes: 16 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Pull Request Labeler"
on:
workflow_dispatch:
pull_request:

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Pull Request Labeler
uses: srvaroa/labeler@v1.11.0
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
59 changes: 31 additions & 28 deletions .github/workflows/version_update_and_zip_on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ on:
types: [published, edited]

jobs:
update_version:
if: ${{ github.event_name == 'release' && github.event.release.prerelease == false && github.event.release.draft == false }}
update_version_and_create_zip:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -20,40 +19,44 @@ jobs:
echo "github.event.release.prerelease: ${{ github.event.release.prerelease }}"
echo "github.event.release.draft: ${{ github.event.release.draft }}"
- name: Update Version in Manifest
if: ${{ github.event_name == 'release' && github.event.release.draft == false }}
run: |
sed -i 's/\"version\"\s*\:\s*\".*\"/\"version\"\:\"${{ github.ref_name }}\"/g' ./custom_components/opnsense/manifest.json
- name: Update Version in const.py
if: ${{ github.event_name == 'release' && github.event.release.draft == false }}
run: |
sed -i 's/VERSION \= \".*\"/VERSION \= \"${{ github.ref_name }}\"/' ./custom_components/opnsense/const.py
- name: Update Changelog
if: ${{ github.event_name == 'release' && github.event.release.draft == false && github.event.release.prerelease == false }}
uses: rhysd/changelog-from-release/action@v3
with:
file: CHANGELOG.md
github_token: ${{ secrets.GITHUB_TOKEN }}
commit: false
- name: Commit & Push Version Changes
if: ${{ github.event_name == 'release' && github.event.release.draft == false && github.event.release.prerelease == false }}
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.event.release.target_commitish }}
message: 'Updating to version ${{ github.ref_name }}'

create_zip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.7
- name: Create Zip
uses: thedoctor0/zip-release@0.7.6
with:
type: 'zip'
filename: 'opnsense.zip'
directory: ./custom_components/opnsense
- name: Upload Zip to Release
if: ${{ github.event_name == 'release' }}
uses: Roang-zero1/github-upload-release-artifacts-action@v3.0.0
with:
args: ./custom_components/opnsense/opnsense.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add Zip to Action
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v4.3.6
with:
name: opnsense
path: ./custom_components/opnsense/opnsense.zip
if-no-files-found: error
- name: Create Zip
uses: thedoctor0/zip-release@0.7.6
with:
type: 'zip'
filename: 'opnsense.zip'
directory: ./custom_components/opnsense
- name: Upload Zip to Release
if: ${{ github.event_name == 'release' }}
uses: Roang-zero1/github-upload-release-artifacts-action@v3.0.0
with:
args: ./custom_components/opnsense/opnsense.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add Zip to Action
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v4.4.0
with:
name: opnsense
path: ./custom_components/opnsense/opnsense.zip
if-no-files-found: error
Loading