Skip to content

Commit 523b14f

Browse files
committed
ci: Initial docker automated build
1 parent eb9dcf3 commit 523b14f

File tree

6 files changed

+293
-0
lines changed

6 files changed

+293
-0
lines changed

.github/workflows/docker-build.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: docker-build
2+
3+
on:
4+
schedule:
5+
- cron: "0 10 * * *"
6+
push:
7+
branches:
8+
- "**"
9+
tags:
10+
- "v*.*.*"
11+
pull_request:
12+
branches:
13+
- "main"
14+
15+
jobs:
16+
docker:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Docker meta
25+
id: meta
26+
uses: docker/metadata-action@v4
27+
with:
28+
# list of Docker images to use as base name for tags
29+
images: |
30+
geokrety/cron
31+
# generate Docker tags based on the following events/attributes
32+
tags: |
33+
type=schedule
34+
type=ref,event=branch
35+
type=ref,event=pr
36+
type=semver,pattern={{version}}
37+
type=sha
38+
39+
- name: Set up QEMU
40+
uses: docker/setup-qemu-action@v2
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v2
44+
45+
- name: Login to Docker Hub
46+
if: github.event_name != 'pull_request'
47+
uses: docker/login-action@v2
48+
with:
49+
username: ${{ vars.DOCKERHUB_USERNAME }}
50+
password: ${{ secrets.DOCKERHUB_TOKEN }}
51+
52+
- name: Build and push - base
53+
uses: docker/build-push-action@v4
54+
with:
55+
file: Dockerfile
56+
push: ${{ github.event_name != 'pull_request' }}
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/dockerlint.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Docker lint
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- '*'
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@master
15+
- name: lint
16+
uses: luke142367/[email protected]
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
TARGET: Dockerfile

.github/workflows/pre-commit.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- '*'
8+
9+
jobs:
10+
11+
pre-commit:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- uses: actions/setup-python@v4
17+
18+
- uses: pre-commit/[email protected]
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Semantic release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
if: "!contains(github.event.head_commit.message, 'skip ci')"
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write # to be able to publish a GitHub release
14+
issues: write # to be able to comment on released issues
15+
pull-requests: write # to be able to comment on released pull requests
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
token: ${{ secrets.GH_TOKEN }}
22+
23+
# setting up Node
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: "lts/*"
28+
29+
# disable package-lock.json to stop it being created
30+
- name: Disable package-lock.json
31+
run: npm config set package-lock false
32+
33+
# Installing package dependencies
34+
- name: Install dependencies
35+
run: |
36+
npm i -D [email protected] conventional-changelog-conventionalcommits semantic-release @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/exec @semantic-release/changelog @semantic-release/github
37+
38+
- name: New tag
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
GIT_AUTHOR_NAME: geokrety-bot
42+
GIT_AUTHOR_EMAIL: [email protected]
43+
GIT_COMMITTER_NAME: geokrety-bot
44+
GIT_COMMITTER_EMAIL: [email protected]
45+
run: npx semantic-release

.pre-commit-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
exclude: |
4+
(?x)(
5+
^vendor/
6+
)
7+
8+
repos:
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v3.2.0
11+
hooks:
12+
- id: trailing-whitespace
13+
- id: end-of-file-fixer
14+
- id: check-yaml
15+
- id: check-added-large-files
16+
- id: check-json
17+
- id: pretty-format-json
18+
args: ["--autofix"]
19+
20+
- repo: https://github.com/Lucas-C/pre-commit-hooks
21+
rev: v1.1.9
22+
hooks:
23+
- id: remove-crlf

.releaserc.json

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"debug": "true",
6+
"plugins": [
7+
[
8+
"@semantic-release/commit-analyzer",
9+
{
10+
"parserOpts": {
11+
"noteKeywords": [
12+
"BREAKING CHANGE",
13+
"BREAKING CHANGES"
14+
]
15+
},
16+
"preset": "angular",
17+
"releaseRules": [
18+
{
19+
"breaking": true,
20+
"release": "major"
21+
},
22+
{
23+
"release": "minor",
24+
"type": "feat"
25+
},
26+
{
27+
"release": "patch",
28+
"type": "fix"
29+
},
30+
{
31+
"release": false,
32+
"type": "docs"
33+
},
34+
{
35+
"release": "patch",
36+
"type": "style"
37+
},
38+
{
39+
"release": "patch",
40+
"type": "refactor"
41+
},
42+
{
43+
"release": "patch",
44+
"type": "perf"
45+
},
46+
{
47+
"release": false,
48+
"type": "test"
49+
},
50+
{
51+
"release": "patch",
52+
"type": "chore"
53+
},
54+
{
55+
"release": "patch",
56+
"type": "dependencies"
57+
},
58+
{
59+
"release": "patch",
60+
"type": "revert"
61+
},
62+
{
63+
"release": "patch",
64+
"type": "translation"
65+
},
66+
{
67+
"release": "patch",
68+
"type": "ci"
69+
}
70+
]
71+
}
72+
],
73+
[
74+
"@semantic-release/release-notes-generator",
75+
{
76+
"parserOpts": {
77+
"noteKeywords": [
78+
"BREAKING CHANGE",
79+
"BREAKING CHANGES"
80+
]
81+
},
82+
"preset": "conventionalCommits",
83+
"presetConfig": {
84+
"types": [
85+
{
86+
"section": "Features",
87+
"type": "feat"
88+
},
89+
{
90+
"section": "Bug Fixes",
91+
"type": "fix"
92+
},
93+
{
94+
"section": "Performance Improvements",
95+
"type": "perf"
96+
},
97+
{
98+
"section": "Reverts",
99+
"type": "revert"
100+
},
101+
{
102+
"section": "Translations",
103+
"type": "translation"
104+
},
105+
{
106+
"section": "Code Refactoring",
107+
"type": "refactor"
108+
},
109+
{
110+
"section": "Style",
111+
"type": "style"
112+
},
113+
{
114+
"hidden": false,
115+
"section": "Dependencies",
116+
"type": "dependencies"
117+
},
118+
{
119+
"hidden": false,
120+
"section": "Chores",
121+
"type": "chore"
122+
}
123+
]
124+
}
125+
}
126+
],
127+
"@semantic-release/changelog",
128+
"@semantic-release/github"
129+
]
130+
}

0 commit comments

Comments
 (0)