Skip to content

Commit 9598776

Browse files
committed
ci: initial docker automated build
1 parent 4aceae0 commit 9598776

File tree

4 files changed

+222
-0
lines changed

4 files changed

+222
-0
lines changed

.github/workflows/docker-build.yml

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

.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@v2
15+
16+
- uses: actions/setup-python@v2
17+
18+
- uses: pre-commit/[email protected]
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
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+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
with:
16+
ssh-key: "${{ secrets.COMMIT_KEY }}"
17+
18+
# setting up Node
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 18
23+
24+
# disable package-lock.json to stop it being created
25+
- name: Disable package-lock.json
26+
run: npm config set package-lock false
27+
28+
# Installing package dependencies
29+
- name: Install dependencies
30+
run: |
31+
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 @semantic-release/git
32+
33+
- name: New tag
34+
env:
35+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
36+
GIT_AUTHOR_NAME: geokrety-bot
37+
GIT_AUTHOR_EMAIL: [email protected]
38+
GIT_COMMITTER_NAME: geokrety-bot
39+
GIT_COMMITTER_EMAIL: [email protected]
40+
run: |
41+
cat > .releaserc.json <<EOF
42+
{
43+
"branches": ["semver", "main", "master"],
44+
"debug": "true",
45+
"plugins": [
46+
["@semantic-release/commit-analyzer",{
47+
"preset": "angular",
48+
"releaseRules": [
49+
{"breaking": true, "release": "major"},
50+
{"type": "feat", "release": "minor"},
51+
{"type": "fix", "release": "patch"},
52+
{"type": "docs", "release": false},
53+
{"type": "style", "release": "patch"},
54+
{"type": "refactor", "release": "patch"},
55+
{"type": "perf", "release": "patch"},
56+
{"type": "test", "release": false},
57+
{"type": "chore", "release": "patch"},
58+
{"type": "dependencies", "release": "patch"},
59+
{"type": "revert", "release": "patch"},
60+
{"type": "translation", "release": "patch"},
61+
{"type": "ci", "release": "patch"}
62+
],
63+
"parserOpts": {
64+
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
65+
}
66+
}],
67+
["@semantic-release/release-notes-generator",{
68+
"preset": "conventionalCommits",
69+
"parserOpts": {
70+
"noteKeywords": [
71+
"BREAKING CHANGE",
72+
"BREAKING CHANGES"
73+
]
74+
},
75+
"presetConfig": {
76+
"types": [
77+
{
78+
"type": "feat",
79+
"section": "Features"
80+
},
81+
{
82+
"type": "fix",
83+
"section": "Bug Fixes"
84+
},
85+
{
86+
"type": "perf",
87+
"section": "Performance Improvements"
88+
},
89+
{
90+
"type": "revert",
91+
"section": "Reverts"
92+
},
93+
{
94+
"type": "translation",
95+
"section": "Translations"
96+
},
97+
{
98+
"type": "refactor",
99+
"section": "Code Refactoring"
100+
},
101+
{
102+
"type": "style",
103+
"section": "Style"
104+
},
105+
{
106+
"type": "dependencies",
107+
"section": "Dependencies",
108+
"hidden": false
109+
},
110+
{
111+
"type": "chore",
112+
"section": "Chores",
113+
"hidden": false
114+
}
115+
]
116+
}
117+
}],
118+
"@semantic-release/changelog",
119+
"@semantic-release/github"
120+
]
121+
}
122+
EOF
123+

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
17+
- repo: https://github.com/Lucas-C/pre-commit-hooks
18+
rev: v1.1.9
19+
hooks:
20+
- id: remove-crlf

0 commit comments

Comments
 (0)