diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..1232144 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,68 @@ +--- +name-template: "v$RESOLVED_VERSION" +tag-template: "v$RESOLVED_VERSION" +template: | + # Changelog + $CHANGES + + See details of [all code changes](https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release + +categories: + - title: "🚀 Features" + labels: + - "feature" + - "enhancement" + - title: "🐛 Bug Fixes" + labels: + - "fix" + - "bugfix" + - "bug" + - title: "🧰 Maintenance" + labels: + - "infrastructure" + - "automation" + - "documentation" + - "dependencies" + - "maintenance" + - "revert" + - title: "🏎 Performance" + label: "performance" +change-template: "- $TITLE @$AUTHOR (#$NUMBER)" +version-resolver: + major: + labels: + - "breaking" + minor: + labels: + - "enhancement" + - "fix" + patch: + labels: + - "documentation" + - "maintenance" + default: patch +autolabeler: + - label: "automation" + title: + - "/^(build|ci|perf|refactor|test).*/i" + - label: "enhancement" + title: + - "/^(style).*/i" + - label: "documentation" + title: + - "/^(docs).*/i" + - label: "feature" + title: + - "/^(feat).*/i" + - label: "fix" + title: + - "/^(fix).*/i" + - label: "infrastructure" + title: + - "/^(infrastructure).*/i" + - label: "maintenance" + title: + - "/^(chore|maintenance).*/i" + - label: "revert" + title: + - "/^(revert).*/i" diff --git a/.github/workflows/auto-labeler.yml b/.github/workflows/auto-labeler.yml new file mode 100644 index 0000000..49ce48c --- /dev/null +++ b/.github/workflows/auto-labeler.yml @@ -0,0 +1,18 @@ +--- +name: "Auto Labeler" +on: + # pull_request_target event is required for autolabeler to support all PRs including forks + pull_request_target: + types: [opened, reopened, edited, synchronize] +permissions: + contents: read +jobs: + auto_labeler: + permissions: + contents: write + pull-requests: write + uses: jmeridth/reusable-workflows/.github/workflows/auto-labeler.yaml@53a9c808122ffaae9af948f72139fb4bd44ab74c + with: + config-name: release-drafter.yml + secrets: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml new file mode 100644 index 0000000..30cc350 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,41 @@ +name: goreleaser + +on: + push: + tags: + - "*" + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + ## After having trouble with the PUBLISHER_TOKEN, I started down this path... + ## But I never got the APP_ID to be accepted by the action + ## Error: [@octokit/auth-app] appId option must be a number or numeric string + # - name: Generate token + # id: generate_token + # uses: tibdex/github-app-token@v1 + # with: + # app_id: ${{ secrets.APP_ID }} + # private_key: ${{ secrets.APP_PEM }} + - name: Checkout + uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + - name: Fetch all tags + run: git fetch --force --tags + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.23.4 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf + with: + distribution: goreleaser + version: ${{ github.ref_name }} + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.PUBLISHER_TOKEN }} diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml index 08a6625..f691726 100644 --- a/.github/workflows/pr-title.yml +++ b/.github/workflows/pr-title.yml @@ -1,38 +1,16 @@ ## Reference: https://github.com/amannn/action-semantic-pull-request --- name: "Lint PR Title" - on: + # pull_request_target event is required for autolabeler to support all PRs including forks pull_request_target: types: [opened, reopened, edited, synchronize] - -permissions: - contents: read - jobs: - main: + lint_pr_title: permissions: + contents: read pull-requests: read statuses: write - name: Validate PR title - runs-on: ubuntu-latest - steps: - - uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - # Configure which types are allowed (newline-delimited). - # From: https://github.com/commitizen/conventional-commit-types/blob/master/index.json - # listing all below - types: | - build - chore - ci - docs - feat - fix - perf - refactor - revert - style - test + uses: jmeridth/reusable-workflows/.github/workflows/pr-title.yaml@53a9c808122ffaae9af948f72139fb4bd44ab74c + secrets: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c68e330..a143ead 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,41 +1,18 @@ -name: goreleaser - +--- +name: "Release" on: - push: - tags: - - "*" - -permissions: - contents: write - + workflow_dispatch: + pull_request_target: + types: [closed] + branches: [main] jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - ## After having trouble with the PUBLISHER_TOKEN, I started down this path... - ## But I never got the APP_ID to be accepted by the action - ## Error: [@octokit/auth-app] appId option must be a number or numeric string - # - name: Generate token - # id: generate_token - # uses: tibdex/github-app-token@v1 - # with: - # app_id: ${{ secrets.APP_ID }} - # private_key: ${{ secrets.APP_PEM }} - - name: Checkout - uses: actions/checkout@v4.2.2 - with: - fetch-depth: 0 - - name: Fetch all tags - run: git fetch --force --tags - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: 1.20.1 - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf - with: - distribution: goreleaser - version: ${{ env.GITHUB_REF_NAME }} - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.PUBLISHER_TOKEN }} + release: + permissions: + contents: write + pull-requests: read + uses: jmeridth/reusable-workflows/.github/workflows/release.yaml@53a9c808122ffaae9af948f72139fb4bd44ab74c + with: + publish: true + release-config-name: release-drafter.yml + secrets: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/go.mod b/go.mod index 0f63986..fc570ab 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/go-git/go-git/v5 v5.13.0 github.com/hashicorp/go-hclog v1.6.3 github.com/hashicorp/go-plugin v1.6.2 - github.com/privateerproj/privateer-sdk v0.0.17 + github.com/privateerproj/privateer-sdk v0.1.0 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index 15e6323..c318036 100644 --- a/go.sum +++ b/go.sum @@ -98,8 +98,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/privateerproj/privateer-sdk v0.0.17 h1:buTquGwlM3+lLggiaWUsOOxlPpNaYOYFv3R39HWN2ss= -github.com/privateerproj/privateer-sdk v0.0.17/go.mod h1:XC29QRTD3NqSVDby1wIVcd3rer5lFFn9I/8Px0xPsrs= +github.com/privateerproj/privateer-sdk v0.1.0 h1:b5/nx4mY3XJjKdsoqkgJMyERI/2af3sKdzongNUyZ10= +github.com/privateerproj/privateer-sdk v0.1.0/go.mod h1:XC29QRTD3NqSVDby1wIVcd3rer5lFFn9I/8Px0xPsrs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=