Skip to content

Commit

Permalink
ci: Initial docker automated build
Browse files Browse the repository at this point in the history
  • Loading branch information
geokrety-bot committed Aug 5, 2023
1 parent ae022ed commit a62daf9
Show file tree
Hide file tree
Showing 6 changed files with 275 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: docker-build

on:
schedule:
- cron: "0 10 * * *"
push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:
branches:
- "main"

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
geokrety/bootstrap-email
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push - base
uses: docker/build-push-action@v4
with:
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
18 changes: 18 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: pre-commit

on:
pull_request:
push:
branches:
- '*'

jobs:

pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4

- uses: pre-commit/[email protected]
45 changes: 45 additions & 0 deletions .github/workflows/semantic-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Semantic release

on:
push:
branches:
- main

jobs:
release:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}

# setting up Node
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"

# disable package-lock.json to stop it being created
- name: Disable package-lock.json
run: npm config set package-lock false

# Installing package dependencies
- name: Install dependencies
run: |
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
- name: New tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: geokrety-bot
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: geokrety-bot
GIT_COMMITTER_EMAIL: [email protected]
run: npx semantic-release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
docker-compose.yml
src/.ruby/
src/.sass-cache/
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: |
(?x)(
^vendor/
)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-json
- id: pretty-format-json
args: ["--autofix"]

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.9
hooks:
- id: remove-crlf
130 changes: 130 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"branches": [
"main"
],
"debug": "true",
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES"
]
},
"preset": "angular",
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"release": "minor",
"type": "feat"
},
{
"release": "patch",
"type": "fix"
},
{
"release": false,
"type": "docs"
},
{
"release": "patch",
"type": "style"
},
{
"release": "patch",
"type": "refactor"
},
{
"release": "patch",
"type": "perf"
},
{
"release": false,
"type": "test"
},
{
"release": "patch",
"type": "chore"
},
{
"release": "patch",
"type": "dependencies"
},
{
"release": "patch",
"type": "revert"
},
{
"release": "patch",
"type": "translation"
},
{
"release": "patch",
"type": "ci"
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES"
]
},
"preset": "conventionalCommits",
"presetConfig": {
"types": [
{
"section": "Features",
"type": "feat"
},
{
"section": "Bug Fixes",
"type": "fix"
},
{
"section": "Performance Improvements",
"type": "perf"
},
{
"section": "Reverts",
"type": "revert"
},
{
"section": "Translations",
"type": "translation"
},
{
"section": "Code Refactoring",
"type": "refactor"
},
{
"section": "Style",
"type": "style"
},
{
"hidden": false,
"section": "Dependencies",
"type": "dependencies"
},
{
"hidden": false,
"section": "Chores",
"type": "chore"
}
]
}
}
],
"@semantic-release/changelog",
"@semantic-release/github"
]
}

0 comments on commit a62daf9

Please sign in to comment.