add deployment to docker

This commit is contained in:
InsanusMokrassar 2023-10-05 20:40:01 +06:00
parent 132349e1ea
commit 8f2c98026b
3 changed files with 49 additions and 0 deletions

23
.github/workflows/docker-publish.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: Docker
on:
push:
branches:
- master
jobs:
publishing:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log into registry
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy
run: ./gradlew build && ./nonsudo_deploy

View File

@ -3,3 +3,5 @@ kotlin.code.style=official
org.gradle.parallel=true
kotlin.js.generate.externals=true
kotlin.incremental=true
version=0.0.3

24
nonsudo_deploy.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
function send_notification() {
echo "$1"
}
function assert_success() {
"${@}"
local status=${?}
if [ ${status} -ne 0 ]; then
send_notification "### Error ${status} at: ${BASH_LINENO[*]} ###"
exit ${status}
fi
}
app=booru_grabber_bot
version="`grep ./gradle.properties -e "^version=" | sed -e "s/version=\(.*\)/\1/"`"
server=insanusmokrassar
assert_success docker build -t $app:"$version" .
assert_success docker tag $app:"$version" $server/$app:$version
assert_success docker tag $app:"$version" $server/$app:latest
assert_success docker push $server/$app:$version
assert_success docker push $server/$app:latest