From c8bcd477c3692097b41bb514bbb0c86b4a890d4d Mon Sep 17 00:00:00 2001 From: andrewstech Date: Thu, 1 Dec 2022 18:17:00 +0000 Subject: [PATCH] CI --- .github/CODEOWNERS | 3 ++ .github/PULL_REQUEST_TEMPLATE.md | 11 ++++++++ .github/dependabot.yml | 10 +++++++ .github/renovate.json | 7 +++++ .github/workflows/deploy.yml | 29 +++++++++++++++++++ .github/workflows/pr.yml | 46 ++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 48 ++++++++++++++++++++++++++++++++ .github/workflows/website.yml | 30 ++++++++++++++++++++ 8 files changed, 184 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/dependabot.yml create mode 100644 .github/renovate.json create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/tests.yml create mode 100644 .github/workflows/website.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..a0c6fb4a --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,3 @@ +# @link + +* @tarampampam diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..fb35ec42 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,11 @@ + + +### Link to Website + +Link: diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..fa68d7cd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +# Docs: + +version: 2 + +updates: + - package-ecosystem: github-actions + directory: / + schedule: {interval: monthly} + reviewers: [tarampampam] + assignees: [tarampampam] diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 00000000..bd6ba4fa --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "github>tarampampam/.github//renovate/default", + ":rebaseStalePrs" + ] +} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..83d5c1fd --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,29 @@ +name: deploy + +on: + workflow_dispatch: {} + push: + branches: [master, main] + paths: [domains/**, .github/workflows/deploy.yml] + +concurrency: + group: ${{ github.ref }}-deploy + cancel-in-progress: false + +jobs: + check: + name: Deploy DNS changes + runs-on: ubuntu-latest + environment: production + steps: + - uses: actions/checkout@v3 + + - uses: gacts/install-dnscontrol@v1 + + - name: Create credentials file + run: echo '{"cloudflare":{"TYPE":"CLOUDFLAREAPI","accountid":"$CF_ID","apitoken":"$CF_TOKEN"}}' > ./creds.json + + - run: dnscontrol push + env: + CF_ID: ${{ secrets.CF_ACCOUNT_ID }} + CF_TOKEN: ${{ secrets.CF_API_TOKEN }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..94b95f05 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,46 @@ +name: pr + +on: + pull_request_target: + types: [opened, synchronize, reopened, ready_for_review, review_requested] # https://bit.ly/3FEj9D4 + branches: [master, main] + +jobs: + check-user-star: + name: Check the user's star + runs-on: ubuntu-latest + steps: + - {uses: gacts/is-stargazer@v1, with: {username: '${{ github.event.pull_request.user.login }}'}, id: check-star} + + - if: steps.check-star.outputs.is-stargazer != 'true' + uses: actions/github-script@v6 + with: + script: core.setFailed('⭐ Please, star this repository!') + + checklist: + name: Message a checklist to the PR + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: thollander/actions-comment-pull-request@v1 + with: + message: | + Your PR has been created! Please now wait for a maintainer to approve it. + + > ### Made a mistake in the record? + > + > Don't worry, you can edit the changes in your repo and they should automatically be added to this PR. + + Please, make sure that your PR passes the following checklist: + + - ⭐ You have starred this repository + - 🗒 The file with your subdomain has a `.json` extension, doesn't contain comments (`// ...`), and is well formatted (indent size - 2 spaces) + - 👤 There is sufficient information in the `owner` field + - 📋 You have clearly described a reason for the domain registration (and what you plan to use it for) in the PR description + - 🔗 The website is reachable and a link to it is in the PR description + - ✅ All CI checks are passed + + + comment_includes: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..37eb8dc7 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,48 @@ +name: tests + +on: + workflow_dispatch: {} + push: + branches: [master, main] + tags-ignore: ['**'] + paths-ignore: ['**.md', 'web/**'] + pull_request: + paths-ignore: ['**.md', 'web/**'] + +concurrency: + group: ${{ github.ref }}-tests + cancel-in-progress: true + +jobs: + gitleaks: + name: GitLeaks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: {fetch-depth: 0} + + - uses: gacts/gitleaks@v1 + + check: + name: DNSControl check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: gacts/install-dnscontrol@v1 + + - run: dnscontrol check + + validate-schemas: + name: Validate schemas + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: walbo/validate-json@v1.1.0 + with: + schema-version: draft-07 + print-valid-files: true + fail-on-missing-schema: true + strict: false + files: ./domains/**/*.json diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml new file mode 100644 index 00000000..78019e8e --- /dev/null +++ b/.github/workflows/website.yml @@ -0,0 +1,30 @@ +name: website + +on: + push: + branches: [master, main] + paths: [web/**, .github/workflows/website.yml] + +concurrency: + group: ${{ github.ref }}-website + cancel-in-progress: true + +jobs: + update: + name: Publish website + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/configure-pages@v2 + + - uses: actions/upload-pages-artifact@v1 + with: {path: web} + + - {uses: actions/deploy-pages@v1, id: deployment}