Skip to content

Commit 7e5e20c

Browse files
committed
chore: add base automations
0 parents  commit 7e5e20c

8 files changed

+216
-0
lines changed

.github/workflows/deployment.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
paths-ignore:
6+
- '**.md'
7+
- '**.*ignore'
8+
- '**.env*'
9+
- renovate.json
10+
- docker-compose.yaml
11+
- '**integration.yaml'
12+
13+
concurrency:
14+
group: deployment-${{ github.ref }}
15+
cancel-in-progress: false
16+
17+
jobs:
18+
deployment:
19+
runs-on: ubuntu-22.04
20+
21+
permissions: read-all
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v3
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Set up QEMU
30+
uses: docker/setup-qemu-action@v2
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v2
34+
35+
- name: Login to Heroku
36+
uses: akhileshns/[email protected]
37+
with:
38+
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
39+
heroku_app_name: ''
40+
heroku_email: ${{secrets.HEROKU_EMAIL}}
41+
justlogin: true
42+
43+
- name: Login to Heroku Container Registry
44+
run: heroku container:login
45+
46+
- name: Build Docker image for the bot
47+
uses: docker/build-push-action@v4
48+
with:
49+
push: true
50+
provenance: false
51+
tags: registry.heroku.com/codinglab-discord-bot/worker
52+
cache-from: type=gha
53+
cache-to: type=gha,mode=max
54+
55+
- name: Deploy the bot
56+
run: heroku container:release worker --app codinglab-discord-bot

.github/workflows/good-practices.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Good Practices
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- '**.md'
9+
- '**.*ignore'
10+
- '**.env*'
11+
- renovate.json
12+
- docker-compose.yaml
13+
- '**deployment.yaml'
14+
15+
jobs:
16+
codeql-analysis:
17+
name: CodeQL Analysis
18+
runs-on: ubuntu-latest
19+
20+
permissions:
21+
security-events: write
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v3
26+
27+
- name: Initialize CodeQL
28+
uses: github/codeql-action/init@v2
29+
with:
30+
languages: javascript
31+
32+
- name: Perform CodeQL Analysis
33+
uses: github/codeql-action/analyze@v2
34+
35+
validate-pr-title:
36+
name: Validate PR title
37+
runs-on: ubuntu-22.04
38+
steps:
39+
- uses: amannn/action-semantic-pull-request@v5
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/integration.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- master
5+
paths-ignore:
6+
- '**.md'
7+
- '**.*ignore'
8+
- '**.env*'
9+
- renovate.json
10+
- docker-compose.yaml
11+
- '**deployment.yaml'
12+
13+
jobs:
14+
integration:
15+
name: Continuous integration
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0
22+
ref: ${{ github.event.pull_request.head.sha }}
23+
24+
- name: Setup pnpm
25+
uses: pnpm/[email protected]
26+
27+
- name: Set up QEMU
28+
uses: docker/setup-qemu-action@v2
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v2
32+
33+
- name: Setup Node
34+
uses: actions/setup-node@v3
35+
with:
36+
node-version-file: .nvmrc
37+
cache: pnpm
38+
39+
- name: Install dependencies
40+
run: pnpm install --frozen-lockfile
41+
42+
- name: Type-check project
43+
run: pnpm typecheck
44+
45+
- name: Lint project
46+
run: pnpm affected:lint
47+
48+
- name: Build project
49+
run: pnpm affected:build
50+
51+
- name: Build Docker image for project
52+
uses: docker/build-push-action@v4
53+
with:
54+
push: false
55+
cache-from: type=gha
56+
cache-to: type=gha,mode=max

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Node
2+
node_modules
3+
4+
# Logs
5+
*.log
6+
7+
# IDE
8+
.vscode
9+
.idea
10+
11+
# Build output
12+
dist
13+
14+
# Environment
15+
.env

.prettierrc.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
printWidth: 100
2+
singleQuote: true
3+
quoteProps: consistent

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"devDependencies": {
3+
"prettier": "^2.8.8"
4+
}
5+
}

pnpm-lock.yaml

+16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

renovate.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["config:base", ":semanticCommitTypeAll(chore)"],
4+
"packageRules": [
5+
{
6+
"groupName": "all dependencies",
7+
"groupSlug": "all",
8+
"packageRules": [
9+
{
10+
"groupName": "all dependencies",
11+
"groupSlug": "all",
12+
"matchPackagePatterns": ["*"],
13+
"ignoreUnstable": false
14+
}
15+
],
16+
"ignoreUnstable": false,
17+
"separateMajorMinor": true
18+
}
19+
],
20+
"timezone": "Europe/Paris",
21+
"schedule": ["every saturday"],
22+
"rangeStrategy": "pin",
23+
"enabledManagers": ["npm", "nvm", "dockerfile", "docker-compose", "github-actions"]
24+
}

0 commit comments

Comments
 (0)