diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..bbfbbc8 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,47 @@ +version: v1 +labels: + - label: "semver:major" + sync: true # remove label if match failed, default: false + matcher: + title: ".*BREAKING.*" + + - label: "semver:minor" + sync: true # remove label if match failed, default: false + matcher: + title: "^feat(?!.*BREAKING).*" + files: + any: ["app/*"] + all: ["!app/config/**"] + count: + gte: 1 + lte: 1000 + + - label: "semver:patch" + sync: true # remove label if match failed, default: false + matcher: + title: "^fix(?!.*BREAKING).*" + + - label: "maintenance" + sync: true # remove label if match failed, default: false + matcher: + title: "^chore(?!.*BREAKING).*" + + - label: "CI/CD" + sync: true # remove label if match failed, default: false + matcher: + files: + any: + - ".github/**" + + - label: "docs" + sync: true # remove label if match failed, default: false + matcher: + files: + any: + - "**/*.md" + +checks: + - context: "Ready to merge" + description: "Disable merging when 'draft' label is set." + labels: + none: ["draft"] diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..b4efbe1 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,33 @@ +name-template: "Version $RESOLVED_VERSION 🎉" +tag-template: "v$RESOLVED_VERSION" +change-template: "- (#$NUMBER) $TITLE — by @$AUTHOR 🫶" +change-title-escapes: '\<*_&' + +categories: + - title: "🚀 Features" + labels: + - "semver:minor" + - title: "🐛 Bug Fixes" + labels: + - "semver:patch" + - title: "🧰 Maintenance" + labels: + - "maintenance" + - title: "👷 Build System" + labels: + - "CI/CD" + +version-resolver: + major: + labels: + - "semver:major" + minor: + labels: + - "semver:minor" + patch: + labels: + - "semver:patch" + default: "patch" + +template: | + $CHANGES diff --git a/.github/update-labels.sh b/.github/update-labels.sh new file mode 100644 index 0000000..d0a43f8 --- /dev/null +++ b/.github/update-labels.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +REPO_NAME="iggy-rs/setup-iggy" +API_URL="https://api.github.com/repos/$REPO_NAME/labels" + +create_label() { + local name="$1" + local color="$2" + local description="$3" + + curl -X POST -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3+json" \ + -d '{"name": "'"$name"'", "color": "'"$color"'", "description": "'"$description"'"}' \ + "$API_URL" +} + +create_label "CI/CD" "93ecdb" "Pull requests bring CI/CD improvements." +create_label "docs" "0075ca" "Improvements or additions to documentation." +create_label "duplicate" "cfd3d7" "This issue or pull request already exists." +create_label "maintenance" "ed4d86" "Maintenance work." +create_label "semver:major" "8151c5" "Label for pull request that brings a major (BREAKING) change." +create_label "semver:minor" "8af85b" "Label for pull request that brings a minor change." +create_label "semver:patch" "fef2c0" "Label for pull request that brings a patch change." diff --git a/.github/workflows/action-self-test.yml b/.github/workflows/action-self-test.yml index ea24847..d966f30 100644 --- a/.github/workflows/action-self-test.yml +++ b/.github/workflows/action-self-test.yml @@ -1,6 +1,8 @@ name: "GitHub Action: Self-Test" on: pull_request: + paths: + - "src/**/.ts" jobs: setup-iggy: diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 02a4f5d..f30ee58 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,6 +1,8 @@ name: Checks on: pull_request: + paths: + - "src/**/.ts" jobs: checks: diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml new file mode 100644 index 0000000..39a91e4 --- /dev/null +++ b/.github/workflows/create-release-draft.yml @@ -0,0 +1,23 @@ +name: Update release draft +on: + push: + branches: + - master + +jobs: + semantic-release: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ secrets.DEPLOY_APP_ID }} + private-key: ${{ secrets.DEPLOY_APP_KEY }} + + - uses: release-drafter/release-drafter@v6 + env: + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} diff --git a/.github/workflows/merge-checks.yaml b/.github/workflows/merge-checks.yaml new file mode 100644 index 0000000..42bd990 --- /dev/null +++ b/.github/workflows/merge-checks.yaml @@ -0,0 +1,27 @@ +name: Merge checks +on: + pull_request: + types: [opened, reopened, synchronize, labeled, unlabeled] + +jobs: + check-labels: + runs-on: ubuntu-latest + permissions: + checks: write + contents: read + issues: write + pull-requests: write + statuses: write + + steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ secrets.DEPLOY_APP_ID }} + private-key: ${{ secrets.DEPLOY_APP_KEY }} + + # https://github.com/fuxingloh/multi-labeler + - name: labels + uses: fuxingloh/multi-labeler@v4 + with: + github-token: ${{ steps.app-token.outputs.token }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 50cbb88..7bb0e69 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,6 +41,7 @@ jobs: - uses: actions/checkout@v4 with: + fetch-depth: 1 token: ${{ steps.app-token.outputs.token }} # Make sure the value of GITHUB_TOKEN will not be persisted in repo's config persist-credentials: false diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 0000000..8fc322a --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,41 @@ +name: Write changelog +on: + push: + tags: + - "v*" + +jobs: + semantic-release: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ secrets.DEPLOY_APP_ID }} + private-key: ${{ secrets.DEPLOY_APP_KEY }} + + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + token: ${{ steps.app-token.outputs.token }} + + - name: Update CHANGELOG + id: changelog + uses: requarks/changelog-action@v1 + with: + token: ${{ steps.app-token.outputs.token }} + tag: ${{ github.ref_name }} + restrictToTypes: "" + reverseOrder: true + excludeTypes: "" + excludeScopes: "" + + - name: Commit CHANGELOG.md + uses: stefanzweifel/git-auto-commit-action@v5 + with: + branch: master + commit_message: "docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]" + file_pattern: CHANGELOG.md diff --git a/.github/workflows/update-labels.yml b/.github/workflows/update-labels.yml new file mode 100644 index 0000000..406b305 --- /dev/null +++ b/.github/workflows/update-labels.yml @@ -0,0 +1,30 @@ +name: Update repository labels +on: + pull_request: + paths: + - ".github/workflows/uptdate-label.yml" + - ".github/update-labels.sh" + +jobs: + checks: + name: Update labels + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ secrets.DEPLOY_APP_ID }} + private-key: ${{ secrets.DEPLOY_APP_KEY }} + + - name: Call script + env: + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} + run: | + chmod +x .github/update-labels.sh + .github/update-labels.sh diff --git a/README.md b/README.md index 49ccfa1..c7c884d 100644 --- a/README.md +++ b/README.md @@ -24,3 +24,11 @@ jobs: - name: Print iggy version run: iggy-server --version ``` + +## Contributions + +Any pull request is welcome! + +### Maintainers + +Every pull request should be reviewed and merged. Once it's done, you can trigger a release at any time going to [releases](https://github.com/iggy-rs/setup-iggy/releases). A draft release is created and updated with new pull request. You can `edit` the release, then `publish` it. It will publish the release and create the adapted tag. It's done!