From bf23e2664324fa0f78b584d8ebbb38621eceb6a3 Mon Sep 17 00:00:00 2001 From: Frederic Leger Date: Fri, 7 Jun 2024 20:03:15 +0200 Subject: [PATCH] ci: better workflows --- .github/dependabot.yml | 27 ++++++++++ .github/release-drafter.yml | 78 +++++++++++++++++++++++++++ .github/workflows/pull-request-ci.yml | 22 ++++++++ .github/workflows/release.yml | 37 +++++++++++++ .github/workflows/stale.yml | 20 +++++++ .github/workflows/tests.yml | 4 +- 6 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/pull-request-ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/stale.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..d3eba5f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,27 @@ +# .github/dependabot.yml +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + open-pull-requests-limit: 20 + schedule: + interval: "weekly" + day: friday + time: '04:00' + + - package-ecosystem: "docker" + directory: "/" + open-pull-requests-limit: 20 + schedule: + interval: "weekly" + day: friday + time: '04:10' + + - package-ecosystem: "pip" + directory: "/" + open-pull-requests-limit: 20 + schedule: + interval: "weekly" + day: friday + time: '04:20' diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..5497e1a --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,78 @@ +template: | + ## What's Changed + + $CHANGES + + ## Full Changelog + + - https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...$RESOLVED_VERSION +name-template: "Version $RESOLVED_VERSION" +tag-template: "$RESOLVED_VERSION" + +categories: + - title: '๐Ÿš€ Features' + labels: + - 'feature' + - 'feat' + - title: '๐Ÿ› Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '๐Ÿงฐ Maintenance' + label: 'chore' + - title: '๐Ÿ“š Documentation' + label: 'docs' + - title: '๐Ÿงช Tests' + label: 'test' + - title: '๐Ÿท๏ธ Version Tags' + label: 'version' + - title: '๐Ÿ”– Release Tags' + label: 'release' + - title: '๐Ÿงฉ Dependencies' + label: 'dependencies' + - title: '๐Ÿ”’ Security' + label: 'security' + - title: '๐Ÿšจ Breaking Changes' + label: 'breaking' + - title: '๐Ÿงน Code Cleanup' + label: 'cleanup' + - title: '๐Ÿ”ง Config' + label: 'config' + - title: '๐Ÿ“ฆ Packages' + label: 'package' + - title: '๐Ÿ”ฅ Removals' + label: 'removal' + - title: '๐Ÿšง Work In Progress' + label: 'wip' + - title: '๐Ÿ”€ Merges' + label: 'merge' + - title: '๐ŸŽจ Style' + label: 'style' + - title: '๐Ÿ”Š Logging' + label: 'logging' + - title: '๐Ÿ”‡ Silence' + label: 'silence' + - title: '๐Ÿค– CI/CD' + label: 'ci' + +version-resolver: + major: + labels: + - "release-major" + minor: + labels: + - "release-minor" + patch: + labels: + - "release-patch" + default: patch + +autolabeler: + - label: "release-major" + title: + - "/^BREAKING CHANGE:/" + - label: "release-minor" + title: + - "/^feat:/" + - "/^feat\\(.+\\):/" diff --git a/.github/workflows/pull-request-ci.yml b/.github/workflows/pull-request-ci.yml new file mode 100644 index 0000000..e5e9be7 --- /dev/null +++ b/.github/workflows/pull-request-ci.yml @@ -0,0 +1,22 @@ +name: Pull request - Continuous Integration + +on: + pull_request: + branches: + - main + - master + +jobs: + + pull-request-labeler: + name: Pull request labeler + runs-on: self-hosted + permissions: + contents: write + pull-requests: write + steps: + - uses: release-drafter/release-drafter@v6 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + disable-releaser: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..99ce61b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: ๐Ÿš€ Release + +on: + workflow_dispatch: + +jobs: + + check-branches: + name: Check branches + runs-on: self-hosted + steps: + - name: Check branch + run: | + if [[ "${{ github.ref_name }}" != "${{ github.event.repository.default_branch }}" ]]; then + echo "This action can only be run on the ${{ github.event.repository.default_branch }} branch" + exit 1 + fi + + update_release_draft: + name: Draft a new release + # we want to publish a new tag only if ci succeeds + needs: check-branches + permissions: + contents: write + pull-requests: write + runs-on: self-hosted + outputs: + latestRelease: ${{ steps.update_release_draft.outputs.tag_name }} + steps: + # create a new release + - id: update_release_draft + uses: release-drafter/release-drafter@v6 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + publish: true + disable-autolabeler: true diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..8048f80 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,20 @@ +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "30 1 * * *" + +jobs: + stale: + runs-on: self-hosted + + steps: + - uses: actions/stale@v9.0.0 + with: + repo-token: ${{ github.token }} + stale-issue-message: "This issue is stale" + stale-pr-message: "This PR is stale" + stale-issue-label: "no-issue-activity" + exempt-issue-labels: "awaiting-approval,work-in-progress" + stale-pr-label: "no-pr-activity" + exempt-pr-labels: "awaiting-approval,work-in-progress" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 06079de..bdf3f43 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,6 +1,8 @@ name: Tests -on: [push] +on: + - push + - pull_request jobs: build: