add gitea workflow
Some checks are pending
Build, push and deploy / builds (push) Waiting to run

This commit is contained in:
John Galt 2024-09-19 17:59:49 +02:00
parent d36363bfa3
commit f93f8a52bb

60
.gitea/workflows/main.yml Normal file
View File

@ -0,0 +1,60 @@
name: Build, push and deploy
on:
push:
branches:
- main
jobs:
builds:
runs-on: herobox-ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
# - name: set up docker cli
# uses: alpinelinux/docker-cli@v1
# with:
# docker-version: '20.10.7'
- name: install docker
run: |
apt-get update
apt-get install -y docker.io
- name: set up docker buildx
uses: docker/setup-buildx-action@v3
- name: log in to docker hub
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin gitea.oio.cat
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: build docker image
run: |
IMG_ID=$(date '+%Y%m%d-%H%M%S')-$(git rev-parse --short HEAD)
echo "1: "
echo $IMG_ID > IMG_ID.output
docker build -t albertabril:$IMG_ID .
- name: tag docker to latest
run: |
IMG_ID=$(cat ./IMG_ID.output) #ensure it is there
echo "2: "
echo $IMG_ID
# docker tag albertabril:$IMG_ID gitea.oio.cat/albert/albertabril:$IMG_ID
# docker tag albertabril:$IMG_ID gitea.oio.cat/albert/albertabril:latest
docker tag albertabril:$IMG_ID gitea.oio.cat/albert/ovh-followup:$IMG_ID
docker tag albertabril:$IMG_ID gitea.oio.cat/albert/ovh-followup:latest
- name: push docker images to gitea.oio.cat hub
run: |
IMG_ID=$(cat ./IMG_ID.output)
echo "3: " $IMG_ID
docker push gitea.oio.cat/albert/ovh-followup:$IMG_ID
docker push gitea.oio.cat/albert/ovh-followup:latest