Skip to content

Commit

Permalink
add awscli, dependabot & release drafter
Browse files Browse the repository at this point in the history
Signed-off-by: André Bauer <[email protected]>
  • Loading branch information
monotek committed Jul 25, 2023
1 parent dcb7e77 commit 9dbfe78
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .github/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- match:
dependency_type: all
update_type: "semver:minor"
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
version: 2
updates:
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
time: "09:00"
timezone: "Europe/Berlin"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
time: "09:00"
timezone: "Europe/Berlin"
37 changes: 37 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧹 Maintenance'
labels:
- 'chore'
- 'dependencies'
version-resolver:
major:
labels:
- 'feature'
minor:
labels:
- 'enhancement'
patch:
labels:
- 'fix'
- 'bugfix'
- 'bug'
- 'chore'
- 'dependencies'
default: patch
template: |
## Changes
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ on:

jobs:
super-linter:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Lint Code Base
uses: github/super-linter/slim@v4
uses: github/super-linter/slim@v5
env:
DEFAULT_BRANCH: master
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docker-build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
Expand All @@ -33,5 +33,5 @@ jobs:
id: docker_build
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
push: false
14 changes: 14 additions & 0 deletions .github/workflows/dependabot-auto-merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: dependabot-auto-merge

on:
pull_request:

jobs:
auto-merge:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: ahmadnassri/action-dependabot-auto-merge@v2
with:
github-token: ${{ secrets.DEPENDABOT_AUTOMERGE }}
target: minor
22 changes: 22 additions & 0 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Release Drafter

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]

permissions:
contents: read

jobs:
update_release_draft:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-22.04
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 5 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ name: release
on:
push:
branches:
- master
- main
tags:
- 'v*'

jobs:
docker-build-push:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
Expand Down Expand Up @@ -43,11 +43,12 @@ jobs:

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
tags: ${{ steps.meta.outputs.tags }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FROM google/cloud-sdk:392.0.0-alpine
FROM google/cloud-sdk:439.0.0-alpine

COPY entrypoint.sh /

# hadolint ignore=DL3018
RUN apk add --no-cache mysql-client rsync && \
RUN apk add --no-cache mysql-client py3-pip rsync && \
pip3 install --no-cache-dir awscli && \
rm -rf /var/cache/apk/* && \
chmod +x /entrypoint.sh

Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ BACKUP_DIR="/tmp"

if [ "$1" = 'mysql-backup-all' ]; then
for DB in $(mysql -h "${MYSQL_HOST}" -u "${MYSQL_USER}" -p "${MYSQL_PASS}" -e "SHOW DATABASES;"| grep -E -v "(|)"); do
echo "backup ${DB}"
echo "backup ${DB}"
mysqldump --opt -h "${MYSQL_HOST}" -u "${MYSQL_USER}" -p "${MYSQL_PASS}" "${DB}" | gzip > /"${BACKUP_DIR}/${TIMESTAMP}_${DB}".sql.gz
done
else
Expand Down

0 comments on commit 9dbfe78

Please sign in to comment.