Skip to content

Commit

Permalink
ci: Initial docker automited build
Browse files Browse the repository at this point in the history
  • Loading branch information
geokrety-bot committed Aug 5, 2023
1 parent 9d6f3b2 commit b4634ed
Show file tree
Hide file tree
Showing 4 changed files with 219 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/basex-amqp-sync
# 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/action@v3
123 changes: 123 additions & 0 deletions .github/workflows/semantic-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Semantic release

on:
push:
branches:
- main

jobs:
release:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ssh-key: "${{ secrets.COMMIT_KEY }}"

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

# 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 @semantic-release/git
- name: New tag
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GIT_AUTHOR_NAME: geokrety-bot
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: geokrety-bot
GIT_COMMITTER_EMAIL: [email protected]
run: |
cat > .releaserc.json <<EOF
{
"branches": ["semver", "main", "master"],
"debug": "true",
"plugins": [
["@semantic-release/commit-analyzer",{
"preset": "angular",
"releaseRules": [
{"breaking": true, "release": "major"},
{"type": "feat", "release": "minor"},
{"type": "fix", "release": "patch"},
{"type": "docs", "release": false},
{"type": "style", "release": "patch"},
{"type": "refactor", "release": "patch"},
{"type": "perf", "release": "patch"},
{"type": "test", "release": false},
{"type": "chore", "release": "patch"},
{"type": "dependencies", "release": "patch"},
{"type": "revert", "release": "patch"},
{"type": "translation", "release": "patch"},
{"type": "ci", "release": "patch"}
],
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
}
}],
["@semantic-release/release-notes-generator",{
"preset": "conventionalCommits",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES"
]
},
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "translation",
"section": "Translations"
},
{
"type": "refactor",
"section": "Code Refactoring"
},
{
"type": "style",
"section": "Style"
},
{
"type": "dependencies",
"section": "Dependencies",
"hidden": false
},
{
"type": "chore",
"section": "Chores",
"hidden": false
}
]
}
}],
"@semantic-release/changelog",
"@semantic-release/github"
]
}
EOF
npx [email protected]
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.9
hooks:
- id: remove-crlf

0 comments on commit b4634ed

Please sign in to comment.