From 8cc970bbb63dd224ab92abc28e423184af2d1983 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Fri, 28 Apr 2023 00:33:21 -0700 Subject: [PATCH] Update release and labeler workflows (#324) --- .github/labeler.yml | 23 +++++++++ .github/release-drafter.yml | 74 --------------------------- .github/release.yml | 29 +++++++++++ .github/workflows/ci.yml | 26 +++++++--- .github/workflows/labeler.yml | 17 ++++++ .github/workflows/release-drafter.yml | 16 ------ 6 files changed, 89 insertions(+), 96 deletions(-) create mode 100644 .github/labeler.yml delete mode 100644 .github/release-drafter.yml create mode 100644 .github/release.yml create mode 100644 .github/workflows/labeler.yml delete mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..a7039c19 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,23 @@ +enhancement: + - head-branch: ['^feature/', '^feat/', '^enhancement/', '^enh/'] + +bug: + - head-branch: ['^fix/', '^bug/'] + +chore: + - head-branch: ['^chore/'] + +tests: + - any: + - head-branch: ['^tests/', '^test/'] + - changed-files: ['tests/**/*'] + - all: + - changed-files: ['!tests/requirements.txt'] + +documentation: + - head-branch: ['^docs/', '^doc/'] + - changed-files: '**/*.md' + +dependencies: + - head-branch: ['^deps/', '^dep/', '^dependabot/'] + - changed-files: ['go.mod', 'go.sum'] diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml deleted file mode 100644 index 2634b76c..00000000 --- a/.github/release-drafter.yml +++ /dev/null @@ -1,74 +0,0 @@ -name-template: 'v$RESOLVED_VERSION' -tag-template: 'v$RESOLVED_VERSION' -categories: - - title: '๐Ÿš€ Features' - labels: - - "enhancement" - - title: '๐Ÿ’ฃ Breaking Change' - labels: - - "change" - - title: '๐Ÿ› Bug Fixes' - labels: - - "bug" - - title: '๐Ÿ“ Documentation' - labels: - - "documentation" - - title: '๐Ÿงช Tests' - labels: - - "tests" - - title: '๐Ÿ”จ Maintenance' - labels: - - "chore" - - title: 'โฌ†๏ธ Dependencies' - labels: - - "dependencies" -version-resolver: - major: - labels: - - 'change' - minor: - labels: - - 'enhancement' - patch: - labels: - - 'bug' - - 'chore' - - 'dependencies' - - 'documentation' - default: patch -exclude-labels: - - 'skip-changelog' -autolabeler: - - label: 'documentation' - files: - - '*.md' - branch: - - '/docs{0,1}\/.+/' - - label: 'chore' - branch: - - '/chore\/.+/' - - label: 'bug' - branch: - - '/fix\/.+/' - title: - - '/fix/i' - - label: 'enhancement' - branch: - - '/enh\/.+/' - - '/enhancement\/.+/' - - '/feat\/.+/' - - '/feature\/.+/' - - label: 'dependencies' - files: - - 'go.mod' - - 'go.sum' - branch: - - '/deps\/.+/' -template: | - ## New in NGINX Plus Integration with Cloud Autoscaling v$RESOLVED_VERSION - - $CHANGES - - ## Resources - - - Documentation -- https://github.com/nginxinc/nginx-asg-sync/blob/v$RESOLVED_VERSION/README.md diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 00000000..ceb3c631 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,29 @@ +changelog: + exclude: + labels: + - skip changelog + categories: + - title: ๐Ÿ’ฃ Breaking Changes + labels: + - change + - title: ๐Ÿš€ Features + labels: + - enhancement + - title: ๐Ÿ› Bug Fixes + labels: + - bug + - title: ๐Ÿงช Tests + labels: + - tests + - title: ๐Ÿ”จ Maintenance + labels: + - chore + - title: ๐Ÿ“ Documentation + labels: + - documentation + - title: โฌ†๏ธ Dependencies + labels: + - dependencies + - title: Other Changes + labels: + - "*" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9a0598c..bdf085b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,14 +25,17 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v3 + - name: Setup Golang Environment uses: actions/setup-go@v4 with: go-version-file: go.mod cache: true + - name: Determine GOPATH id: go run: echo "go_path=$(go env GOPATH)" >> $GITHUB_OUTPUT + - name: Build binary uses: goreleaser/goreleaser-action@v4 with: @@ -48,11 +51,13 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v3 + - name: Setup Golang Environment uses: actions/setup-go@v4 with: go-version-file: go.mod cache: true + - name: Run Tests run: make test @@ -65,23 +70,32 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Setup Golang Environment uses: actions/setup-go@v4 with: go-version-file: go.mod cache: true + - name: Determine GOPATH id: go run: echo "go_path=$(go env GOPATH)" >> $GITHUB_OUTPUT - - name: Publish Release Notes - uses: release-drafter/release-drafter@v5 + + - name: Draft Release Notes + uses: lucacome/draft-release@v0.2.0 with: - publish: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - if: ${{ startsWith(github.ref, 'refs/tags/') }} + minor-label: 'enhancement' + major-label: 'change' + publish: ${{ startsWith(github.ref, 'refs/tags/') }} + notes-footer: | + ## Resources + + - Documentation -- https://github.com/nginxinc/nginx-asg-sync/blob/{{version}}/README.md + if: github.event_name != 'pull_request' + - name: Download Syft uses: anchore/sbom-action/download-syft@v0.14.1 + - name: Build binaries uses: goreleaser/goreleaser-action@v4 with: diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 00000000..7cea7455 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,17 @@ +name: "Pull Request Labeler" +on: + - pull_request_target + +permissions: + contents: read + +jobs: + triage: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: joshdales/labeler@68a25980166b8ff8eb977d9a31cab5bd883793e1 # if https://github.com/actions/labeler/pull/203 is merged, use the official action actions/labeler + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml deleted file mode 100644 index cd79a3df..00000000 --- a/.github/workflows/release-drafter.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Release Drafter - -on: - push: - branches: - - main - pull_request: - types: [opened, reopened, synchronize] - -jobs: - update_release_draft: - runs-on: ubuntu-22.04 - steps: - - uses: release-drafter/release-drafter@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}