From 1596afa292aa410ab6f3d173f30d871ce7b649fa Mon Sep 17 00:00:00 2001 From: Donavan Becker Date: Mon, 8 Jan 2024 22:15:05 -0600 Subject: [PATCH 1/2] Update Release Process --- .../ISSUE_TEMPLATE/wiki-change-request.yml | 33 +++++ .github/labeler.yml | 11 ++ .github/release.yml | 21 +++ .github/workflows/create_raspbian_pi-gen.yml | 137 +++++++++++------- .github/workflows/discord-webhooks.yml | 17 --- .github/workflows/labeler.yml | 12 ++ .github/workflows/pr-labeler.yml | 12 ++ .github/workflows/release-drafter.yml | 15 ++ 8 files changed, 185 insertions(+), 73 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/wiki-change-request.yml create mode 100644 .github/labeler.yml create mode 100644 .github/release.yml delete mode 100644 .github/workflows/discord-webhooks.yml create mode 100644 .github/workflows/labeler.yml create mode 100644 .github/workflows/pr-labeler.yml create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/ISSUE_TEMPLATE/wiki-change-request.yml b/.github/ISSUE_TEMPLATE/wiki-change-request.yml new file mode 100644 index 0000000..622e701 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/wiki-change-request.yml @@ -0,0 +1,33 @@ +name: Wiki Change Request +description: want change? +labels: ["wiki change request"] +body: + - type: markdown + attributes: + value: | + Please read the following before you start filling out this form: + + * This form is for requesting changes to the Homebridge Organization wiki pages only. + - type: textarea + id: proposed-change + attributes: + label: Proposed Change + description: | + Please describe the change you would like to see made to the wiki page. + + If you are requesting a new page, please describe the page you would like to see created. + + placeholder: | + Tip: You can attach images or files by clicking this area to highlight it and then dragging files in. + validations: + required: true + - type: input + id: wiki-page + attributes: + label: Wiki Page Link + description: | + Please provide a link to the wiki page you would like to see changed. + + If you are requesting a new page, please provide details of where you would like to see this page linked from. + validations: + required: true diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..78331e1 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,11 @@ +# Add 'beta' label to any PR where the base branch name starts with `beta` or has a `beta` section in the name +beta: + - base-branch: ['^beta', 'beta', 'beta*'] + +# Add 'beta' label to any PR where the base branch name starts with `beta` or has a `beta` section in the name +alpha: + - base-branch: ['^alpha', 'alpha', 'alpha*'] + +# Add 'latest' label to any PR where the base branch name starts with `latest` or has a `latest` section in the name +latest: + - base-branch: ['^latest', 'latest', 'latest*'] \ No newline at end of file diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..0dee440 --- /dev/null +++ b/.github/release.yml @@ -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" + - "*" diff --git a/.github/workflows/create_raspbian_pi-gen.yml b/.github/workflows/create_raspbian_pi-gen.yml index bf0a001..76bd098 100644 --- a/.github/workflows/create_raspbian_pi-gen.yml +++ b/.github/workflows/create_raspbian_pi-gen.yml @@ -1,32 +1,37 @@ name: Create Raspbian Homebridge Image using pi-gen -run-name: Create Raspbian Homebridge Image ${{ github.event.inputs.version }} against ${{ github.ref_name }} +run-name: Create Raspbian Homebridge Image ${{ github.ref }} on: - workflow_dispatch: - inputs: - version: - description: 'Version / Tag (vx.x.x):' - required: true + release: + types: [released] jobs: - setup_environment: - name: Setup Environment ${{ github.event.inputs.version }} - runs-on: [ubuntu-latest] + tag: + name: Verify Release Tag + runs-on: ubuntu-latest + outputs: + version: ${{ steps.get_version.outputs.version }} steps: - - name: Create Release ${{ github.event.inputs.version }} - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.event.inputs.version }} - release_name: ${{ github.event.inputs.version }} - draft: false - prerelease: true - + - 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_images: - name: Build RPI Homebridge (${{ matrix.name }}) - needs: setup_environment + name: Build RPI Homebridge (${{ matrix.name }}) Image ${{ needs.tag.outputs.version }} + needs: tag runs-on: [ubuntu-latest] strategy: fail-fast: false @@ -81,7 +86,7 @@ jobs: # Additional options to include in PIGEN_DOCKER_OPTS # '--env IMG_DATE=Raspbian' - docker-opts: '--env BUILD_VERSION="${{ github.repository }}-${{ github.event.inputs.version }}-\(${{ matrix.name }}\)"' + docker-opts: '--env BUILD_VERSION="${{ github.repository }}-${{ needs.tag.outputs.version }}-\(${{ matrix.name }}\)"' # Set whether a NOOBS image should be built as well. If enabled, the output # directory containing the NOOBS files will be saved as output variable @@ -192,12 +197,12 @@ jobs: echo "$IMAGE_SHA256_CHECKSUM ${{ steps.build.outputs.image-path }}" echo "::notice::IMAGE_SHA256_CHECKSUM ${IMGFILENAME} ==> ${IMAGE_SHA256_CHECKSUM}" - - name: Upload Image to release ${{ github.event.inputs.version }} + - name: Upload Image to release ${{ needs.tag.outputs.version }} uses: AButler/upload-release-assets@v2.0.2 with: files: '${{ steps.build.outputs.image-path }}' repo-token: ${{ secrets.GITHUB_TOKEN }} - release-tag: ${{ github.event.inputs.version }} + release-tag: ${{ needs.tag.outputs.version }} - name: Generate rpi-image-repo.json id: generate_rpi-image-repo @@ -206,7 +211,7 @@ jobs: export RPI_IMAGER_DESCRIPTION="Official Homebridge Raspberry Pi Image ${{ matrix.release }} (${{ matrix.name }})" export RPI_IMAGER_ICON="https://user-images.githubusercontent.com/3979615/116509191-3c35f880-a906-11eb-9a7f-7cad7c2aa641.png" export RPI_IMAGER_WEBSITE="https://github.com/homebridge/homebridge-raspbian-image/wiki/Getting-Started" - export RPI_IMAGER_IMAGE_URL="https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.version }}/${{ env.IMGFILENAME }}" + export RPI_IMAGER_IMAGE_URL="https://github.com/${{ github.repository }}/releases/download/${{ needs.tag.outputs.version }}/${{ env.IMGFILENAME }}" export RPI_IMAGER_DEVICES='${{ matrix.devices }}' ./make_rpi-imager-snipplet.py --rpi_imager_url ${RPI_IMAGER_IMAGE_URL} @@ -214,42 +219,62 @@ jobs: run: | mv pi-gen/deploy/rpi-image-repo.json ./rpi-image-repo-${{ matrix.name }}.json - - name: Upload Info to release ${{ github.event.inputs.version }} + - name: Upload Info to release ${{ needs.tag.outputs.version }} uses: AButler/upload-release-assets@v2.0.2 with: files: './*.json' repo-token: ${{ secrets.GITHUB_TOKEN }} - release-tag: ${{ github.event.inputs.version }} + release-tag: ${{ needs.tag.outputs.version }} finalize_info: - name: Prep ${{ github.event.inputs.version }} Info file - needs: build_images + name: Prep ${{ needs.tag.outputs.version }} Info file + needs: [tag, build_images] runs-on: [ubuntu-latest] steps: - - uses: actions/checkout@v4 - - - uses: robinraju/release-downloader@v1.8 - name: Downloard image info files from release ${{ github.event.inputs.version }} - with: - - # The github tag. e.g: v1.0.1 - # Download assets from a specific tag/version - tag: "${{ github.event.inputs.version }}" - - # The name of the file to download. - # Use this field only to specify filenames other than tarball or zipball, if any. - # Supports wildcard pattern (eg: '*', '*.deb', '*.zip' etc..) - fileName: "*.json" - - - name: Combine rpi-image-repo JSON's - run: | - ./combine-rpi-imager-snipplet.py - - - name: Upload combined rpi-image-repo to release ${{ github.event.inputs.version }} - uses: AButler/upload-release-assets@v2.0.2 - with: - files: 'rpi-image-repo.json' - repo-token: ${{ secrets.GITHUB_TOKEN }} - release-tag: ${{ github.event.inputs.version }} - + - uses: actions/checkout@v4 + + - uses: robinraju/release-downloader@v1.8 + name: Downloard image info files from release ${{ needs.tag.outputs.version }} + with: + + # The github tag. e.g: v1.0.1 + # Download assets from a specific tag/version + tag: "${{ needs.tag.outputs.version }}" + + # The name of the file to download. + # Use this field only to specify filenames other than tarball or zipball, if any. + # Supports wildcard pattern (eg: '*', '*.deb', '*.zip' etc..) + fileName: "*.json" + + - name: Combine rpi-image-repo JSON's + run: | + ./combine-rpi-imager-snipplet.py + + - name: Upload combined rpi-image-repo to release ${{ needs.tag.outputs.version }} + uses: AButler/upload-release-assets@v2.0.2 + with: + files: 'rpi-image-repo.json' + repo-token: ${{ secrets.GITHUB_TOKEN }} + release-tag: ${{ needs.tag.outputs.version }} + + - name: Push ${{ needs.tag.outputs.version }} Image to Homebridge Registry + uses: dmnemec/copy_file_to_another_repo_action@main + env: + API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} + with: + source_file: 'rpi-image-repo.json' + destination_repo: 'homebridge/homebridge.io' + destination_folder: 'src/public/' + user_email: 'github-actions[bot]@users.noreply.github.com' + user_name: 'github-actions[bot]' + commit_message: 'New Homebridge Image Release ${{ needs.tag.outputs.version }}' + + + github-releases-to-discord: + needs: [tag, build_images, finalize_info] + uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest + with: + footer_title: "Homebridge Raspbian Image" + secrets: + DISCORD_WEBHOOK_URL_LATEST: ${{ secrets.DISCORD_WEBHOOK_URL_LATEST }} \ No newline at end of file diff --git a/.github/workflows/discord-webhooks.yml b/.github/workflows/discord-webhooks.yml deleted file mode 100644 index 3c3520e..0000000 --- a/.github/workflows/discord-webhooks.yml +++ /dev/null @@ -1,17 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Discord Webhooks - -# Controls when the workflow will run -on: - release: - types: [released, prereleased] - -jobs: - github-releases-to-discord: - uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest - with: - footer_title: "Homebridge Raspbian Image" - secrets: - DISCORD_WEBHOOK_URL_LATEST: ${{ secrets.DISCORD_WEBHOOK_URL_LATEST }} - DISCORD_WEBHOOK_URL_BETA: ${{ secrets.DISCORD_WEBHOOK_URL_LATEST }} \ No newline at end of file diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..e20474e --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,12 @@ +name: Labeler + +on: + pull_request_target: # required for auto labeler + types: [opened, reopened, synchronize] + workflow_dispatch: + +jobs: + stale: + uses: homebridge/.github/.github/workflows/labeler.yml@latest + secrets: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml new file mode 100644 index 0000000..8b606ea --- /dev/null +++ b/.github/workflows/pr-labeler.yml @@ -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@latest + secrets: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..5c50042 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,15 @@ +name: Release Drafter + +on: + push: + branches: [latest] + pull_request: # required for autolabeler + branches: [latest] + types: [opened, reopened, synchronize, ready_for_review, review_requested] + workflow_dispatch: + +jobs: + stale: + uses: homebridge/.github/.github/workflows/release-drafter.yml@latest + secrets: + token: ${{ secrets.GITHUB_TOKEN }} From 94599facb20263f9f972a71fe3291eb309ec096d Mon Sep 17 00:00:00 2001 From: Donavan Becker Date: Thu, 2 May 2024 19:11:38 -0500 Subject: [PATCH 2/2] dont create draft releases. --- .github/release.yml | 21 --------------------- .github/workflows/release-drafter.yml | 15 --------------- 2 files changed, 36 deletions(-) delete mode 100644 .github/release.yml delete mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/release.yml b/.github/release.yml deleted file mode 100644 index 0dee440..0000000 --- a/.github/release.yml +++ /dev/null @@ -1,21 +0,0 @@ -# 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" - - "*" diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml deleted file mode 100644 index 5c50042..0000000 --- a/.github/workflows/release-drafter.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Release Drafter - -on: - push: - branches: [latest] - pull_request: # required for autolabeler - branches: [latest] - types: [opened, reopened, synchronize, ready_for_review, review_requested] - workflow_dispatch: - -jobs: - stale: - uses: homebridge/.github/.github/workflows/release-drafter.yml@latest - secrets: - token: ${{ secrets.GITHUB_TOKEN }}