From caf8d434b271b0aa34963d650b7a49287f608029 Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Fri, 23 Feb 2024 09:49:02 +0100 Subject: [PATCH] feat(github): Setup Github Actions Signed-off-by: Nicolas Lamirault --- .github/dependabot.yml | 14 ----- .github/issue_label_bot.yaml | 18 +++++++ .github/labels.yaml | 46 ++++++++++++++++ .github/release-drafter.yml | 58 ++++++++++++++++++++ .github/renovate.json5 | 39 ++++++++++++++ .github/workflows/draft-labels.yml | 30 +++++++++++ .github/workflows/pages.yml | 76 +++++++++++++++++++++++++++ .github/workflows/prow-labels.yml | 39 ++++++++++++++ .github/workflows/prow-lgtm-merge.yml | 31 +++++++++++ .github/workflows/prow-lgtm-pull.yml | 25 +++++++++ .github/workflows/prow.yml | 43 +++++++++++++++ .github/workflows/release-drafter.yml | 33 ++++++++++++ .github/workflows/renovate.yml | 47 +++++++++++++++++ .github/workflows/size.yaml | 38 ++++++++++++++ 14 files changed, 523 insertions(+), 14 deletions(-) delete mode 100644 .github/dependabot.yml create mode 100644 .github/issue_label_bot.yaml create mode 100644 .github/labels.yaml create mode 100644 .github/release-drafter.yml create mode 100644 .github/renovate.json5 create mode 100644 .github/workflows/draft-labels.yml create mode 100644 .github/workflows/pages.yml create mode 100644 .github/workflows/prow-labels.yml create mode 100644 .github/workflows/prow-lgtm-merge.yml create mode 100644 .github/workflows/prow-lgtm-pull.yml create mode 100644 .github/workflows/prow.yml create mode 100644 .github/workflows/release-drafter.yml create mode 100644 .github/workflows/renovate.yml create mode 100644 .github/workflows/size.yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 573e2f0..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: 2 -updates: -- package-ecosystem: npm - directory: "/" - schedule: - interval: daily - time: '20:00' - open-pull-requests-limit: 10 -- package-ecosystem: bundler - directory: "/" - schedule: - interval: daily - time: '20:00' - open-pull-requests-limit: 10 diff --git a/.github/issue_label_bot.yaml b/.github/issue_label_bot.yaml new file mode 100644 index 0000000..eae2b86 --- /dev/null +++ b/.github/issue_label_bot.yaml @@ -0,0 +1,18 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +label-alias: + bug: 'kind/bug' + feature_request: 'kind/feature' + question: 'kind/question' diff --git a/.github/labels.yaml b/.github/labels.yaml new file mode 100644 index 0000000..f1e8585 --- /dev/null +++ b/.github/labels.yaml @@ -0,0 +1,46 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# labels to be used with /area command +area: + - 'hugo' + - 'docsy' + +kind: + - 'documentation' + - 'discussion' + - 'feature' + - 'question' + +priority: + - 'low' + - 'medium' + - 'high' + - 'critical' + +status: + - available + - blocked + - in_progress + - on_hold + +# File globs for PR labeler +# tests: +# - '**/*.test.ts' + +'area/hugo': + - content/**/* + +'area/docsy': + - themes/docsy/**/* diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..d4e48b6 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,58 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name-template: 'v$RESOLVED_VERSION 🌈' +tag-template: 'v$RESOLVED_VERSION' +# https://gitmoji.carloscuesta.me/ +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - 'kind/feature' + - 'kind/enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'kind/bug' + - 'fix' + - 'bugfix' + - 'bug' + - title: '🚨 Maintenance' + labels: + - 'kind/renovate' + - 'area/renovate' + - 'chore' + - title: '📝 Documentation' + labels: + - 'kind/documentation' + - title: '💡 Question' + labels: + - 'kind/question' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: patch +template: | + ## 🚧 Changes + + $CHANGES diff --git a/.github/renovate.json5 b/.github/renovate.json5 new file mode 100644 index 0000000..6af07c3 --- /dev/null +++ b/.github/renovate.json5 @@ -0,0 +1,39 @@ +{ + "extends": [ + "config:base", + ":gitSignOff" + ], + "enabled": true, + "timezone": "Europe/Paris", + "dependencyDashboard": true, + "dependencyDashboardTitle": "Renovate Dashboard", + // "gitAuthor": "Nicolas Lamirault ", + // "commitBody": "Signed-off-by: Nicolas Lamirault ", + // Do not notify on closed unmerged PRs + "suppressNotifications": ["prIgnoreNotification"], + // Do not rebase PRs + "rebaseWhen": "conflicted", + "assignees": ["@nlamirault"], + "reviewersFromCodeOwners": true, + "helm-values": { + "fileMatch": ["kubernetes/.+\\.yaml$"] + }, + "labels": ["kind/renovate"], + "packageRules": [ + // Setup datasources + // Enable auto-merge docker + // { + // "datasources": ["docker"], + // "automerge": true, + // "requiredStatusChecks": null, + // "updateTypes": ["minor", "patch"], + // }, + // Enable auto-merge helm + // { + // "datasources": ["helm"], + // "automerge": true, + // "requiredStatusChecks": null, + // "updateTypes": ["patch"], + // } + ] +} diff --git a/.github/workflows/draft-labels.yml b/.github/workflows/draft-labels.yml new file mode 100644 index 0000000..a3e90c9 --- /dev/null +++ b/.github/workflows/draft-labels.yml @@ -0,0 +1,30 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Project / Draft PR Labels + +on: + pull_request: + types: [opened, ready_for_review] + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - name: label swapping + uses: jinmayamashita/ready-for-review@1.0.0 + with: + in-progress-label: 'status/in_progress' + ready-for-review-label: 'status/review_needed' + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..c8e23b9 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,76 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Project / Website + +on: + push: + branches: + - master + +jobs: + build-deploy: + runs-on: ubuntu-latest + + # steps: + # - name: Checkout Repo + # uses: actions/checkout@master + # with: + # submodules: true + + # - name: Install dependencies + # run: | + # npm install + + # - name: Publish Site + # uses: chabad360/hugo-gh-pages@master + # with: + # githubToken: "${{ secrets.GITHUB_TOKEN }}" + + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive # Fetch Hugo themes + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: '0.79.1' + extended: true + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '12.x' + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - run: npm ci + + - name: Build + run: hugo --minify + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public + cname: www.portefaix.xyz diff --git a/.github/workflows/prow-labels.yml b/.github/workflows/prow-labels.yml new file mode 100644 index 0000000..87a1c37 --- /dev/null +++ b/.github/workflows/prow-labels.yml @@ -0,0 +1,39 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# name: "Label PRs from globs" +# on: +# schedule: +# - cron: "0 * * * *" + +# jobs: +# execute: +# runs-on: ubuntu-latest +# steps: +# - uses: jpmcb/prow-github-actions@v1.1.1 +# with: +# jobs: 'pr-labeler' +# github-token: "${{ secrets.GITHUB_TOKEN }}" + +name: Prow / Pull Request Labeler +on: +- pull_request_target + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v4.3.0 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/prow-lgtm-merge.yml b/.github/workflows/prow-lgtm-merge.yml new file mode 100644 index 0000000..978202d --- /dev/null +++ b/.github/workflows/prow-lgtm-merge.yml @@ -0,0 +1,31 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Prow / Merge on lgtm label +on: + schedule: + - cron: "0 * * * *" + +jobs: + execute: + runs-on: ubuntu-latest + steps: + - uses: jpmcb/prow-github-actions@v1.1.3 + with: + jobs: 'lgtm' + github-token: "${{ secrets.GITHUB_TOKEN }}" + + # this configuration is optional and will default to 'merge' + # possible options are 'merge', 'rebase', or 'squash' + merge-method: 'squash' diff --git a/.github/workflows/prow-lgtm-pull.yml b/.github/workflows/prow-lgtm-pull.yml new file mode 100644 index 0000000..935c213 --- /dev/null +++ b/.github/workflows/prow-lgtm-pull.yml @@ -0,0 +1,25 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Prow / Run Jobs on PR +on: pull_request + +jobs: + execute: + runs-on: ubuntu-latest + steps: + - uses: jpmcb/prow-github-actions@v1.1.3 + with: + jobs: 'lgtm' + github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/prow.yml b/.github/workflows/prow.yml new file mode 100644 index 0000000..4d2fde7 --- /dev/null +++ b/.github/workflows/prow.yml @@ -0,0 +1,43 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Prow / Github Actions +on: + issue_comment: + types: [created] + +jobs: + execute: + runs-on: ubuntu-latest + steps: + - uses: jpmcb/prow-github-actions@v1.1.3 + with: + prow-commands: '/assign + /unassign + /approve + /retitle + /area + /kind + /priority + /status + /remove + /lgtm + /close + /reopen + /lock + /milestone + /hold + /cc + /uncc' + github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..8c49ab4 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,33 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Project / Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - master + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml + # with: + # config-name: my-config.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml new file mode 100644 index 0000000..c08086f --- /dev/null +++ b/.github/workflows/renovate.yml @@ -0,0 +1,47 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Renovate / Helm releases + +on: + workflow_dispatch: + schedule: + - cron: "0 * * * *" + +jobs: + renovate-helmrelease: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + + # - name: Update Helm Releases + # run: | + # docker-compose run -T --rm builder bootstrap/renovate-helm-releases.sh + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: update/pre-commit-auto-update + delete-branch: true + title: Auto-update pre-commit hooks + signoff: true + committer: "Nicolas Lamirault " + author: "Nicolas Lamirault " + commit-message: Auto-update pre-commit hooks + body: | + Signed-off-by: Nicolas Lamirault + labels: dependencies, merge diff --git a/.github/workflows/size.yaml b/.github/workflows/size.yaml new file mode 100644 index 0000000..8457d69 --- /dev/null +++ b/.github/workflows/size.yaml @@ -0,0 +1,38 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Project / Size PR + +on: + pull_request: + types: [opened, synchronize] + +jobs: + update_labels: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions-ecosystem/action-size@v2 + id: size + + - uses: actions-ecosystem/action-remove-labels@v1 + with: + github_token: ${{ secrets.github_token }} + labels: ${{ steps.size.outputs.stale_labels }} + + - uses: actions-ecosystem/action-add-labels@v1 + with: + github_token: ${{ secrets.github_token }} + labels: ${{ steps.size.outputs.new_label }}