1
0
Fork 0

[CICD] Switch to gitea-actions as CI/CD
Build Docker and Deploy / Build Docker (push) Failing after 15s Details
Build Docker and Deploy / Deploy to Server (push) Has been skipped Details

This commit is contained in:
Mike Schwörer 2023-08-26 19:36:10 +02:00
parent 74359ef6f7
commit b297450666
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
3 changed files with 48 additions and 2 deletions

View File

@ -1,3 +1,4 @@
#!/bin/bash
echo "" > /var/log/msmtp

View File

@ -0,0 +1,45 @@
# https://docs.gitea.com/next/usage/actions/quickstart
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
name: Build Docker and Deploy
run-name: Build & Deploy ${{ gitea.ref }} on ${{ gitea.actor }}
on:
push:
branches: ['master']
jobs:
build:
name: Build Docker
runs-on: bfb-cicd-latest
steps:
- run: echo -n "${{ secrets.DOCKER_REG_PASS }}" | docker login registry.blackforestbytes.com -u docker --password-stdin
- run: echo -n "${{ secrets.DOCKER_IO_PASS }}" | docker login -u "${{DOCKER_IO_USER}}" --password-stdin
- name: Check out code
uses: actions/checkout@v3
- run: cd "${{ gitea.workspace }}" && make clean
- run: cd "${{ gitea.workspace }}" && make docker
- run: cd "${{ gitea.workspace }}" && make push-docker
deploy:
name: Deploy to Server
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Info
run: echo "Branch := ${{ gitea.ref_name }}"
- name: Deploy [develop] on remote (via ssh)
uses: appleboy/ssh-action@v1.0.0
with:
host: test.blackforestbytes.com
username: tc
port: 1337
key: "${{ secrets.SSH_KEY_BFBDEPLOYBOT }}"
script: sudo /var/docker/__run/website.sh

View File

@ -9,7 +9,7 @@ HASH=$(shell git rev-parse HEAD)
run:
php -S localhost:8000 -t .
build-docker:
docker:
[ ! -f "DOCKER_GIT_INFO" ] || rm DOCKER_GIT_INFO
git rev-parse --abbrev-ref HEAD >> DOCKER_GIT_INFO
git rev-parse HEAD >> DOCKER_GIT_INFO
@ -53,7 +53,7 @@ inspect-docker:
$(DOCKER_NAME):latest \
bash
push-docker: build-docker
push-docker:
docker image push $(DOCKER_REPO)/$(DOCKER_NAME):$(HASH)
docker image push $(DOCKER_REPO)/$(DOCKER_NAME):$(NAMESPACE)-latest
docker image push $(DOCKER_REPO)/$(DOCKER_NAME):latest