From f93f8a52bbca720d6efcd6fcebc43ef0f53210d4 Mon Sep 17 00:00:00 2001 From: John Galt Date: Thu, 19 Sep 2024 17:59:49 +0200 Subject: [PATCH] add gitea workflow --- .gitea/workflows/main.yml | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .gitea/workflows/main.yml diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml new file mode 100644 index 0000000..c6e99cc --- /dev/null +++ b/.gitea/workflows/main.yml @@ -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 + +