2023-10-09 22:56:07 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker-image:
|
2024-01-09 23:52:00 +01:00
|
|
|
runs-on: docker
|
|
|
|
steps:
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
echo deb http://deb.debian.org/debian bullseye-backports main | tee /etc/apt/sources.list.d/backports.list
|
|
|
|
apt-get update -qq
|
|
|
|
apt-get install -y git
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -qq -y -t bullseye-backports docker.io
|
|
|
|
|
|
|
|
- name: Checkout the sourcecode
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Docker build environment (rootless)
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
with:
|
|
|
|
driver-opts: |
|
|
|
|
image=moby/buildkit:v0.12.1-rootless
|
|
|
|
network=host
|
|
|
|
|
|
|
|
- name: Login to forgejo docker registry
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: git.okoyono.de
|
|
|
|
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
|
|
|
|
|
|
|
|
- name: Build and push the docker image
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
with:
|
|
|
|
push: true
|
|
|
|
tags: git.okoyono.de/okoyono-intern/okospaceapi:latest
|
|
|
|
|
|
|
|
deployment:
|
2024-01-09 23:41:36 +01:00
|
|
|
runs-on: self-hosted
|
2023-10-09 22:56:07 +02:00
|
|
|
steps:
|
2024-01-09 23:55:33 +01:00
|
|
|
# As an alternative, we could connect to the server via ssh and execute the
|
|
|
|
# script directly, but I like the webhook thing much more, because it is
|
|
|
|
# so much more versatile.
|
2024-01-09 23:36:51 +01:00
|
|
|
- name: Deploy via webhook
|
2023-10-09 22:56:07 +02:00
|
|
|
run: |
|
2024-01-09 23:45:24 +01:00
|
|
|
apk add curl
|
2024-01-09 23:48:51 +01:00
|
|
|
curl -v -X GET "http://host.docker.internal:8100?token=${{ secrets.DEPLOY_TOKEN }}&script=deploy-spaceapi.sh"
|