Files
mastobot/.gitea/workflows/build.yaml
John Ahlroos ea9e9556f4
Some checks failed
Build & Release / build-docker-image (push) Successful in 2m39s
Build & Release / deploy-to-production (push) Failing after 6s
scope docker credentials
2026-02-24 20:12:53 +01:00

72 lines
2.2 KiB
YAML

name: Build & Release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
env:
ENDPOINT: services-3
STACK: mastodon
IMAGE: docker/mastobot
TAG: ${{ gitea.ref_name }}
CACHE_NAME: cache-python-dependencies-mastobot
RUNNER_TOOL_CACHE: /toolcache
jobs:
build-docker-image:
runs-on: node20
container:
image: catthehacker/ubuntu:act-24.04
steps:
- name: Checkout Docker file
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.SSH_JOHN_PRIVATE_KEY }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Devsoap Container Registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_REGISTRY_USER }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
scope: ${{secrets.DOCKER_REGISTRY}}/${{env.IMAGE}}@push
logout: true
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
build-args: |
version=${{env.TAG}}
tags: |
${{secrets.DOCKER_REGISTRY}}/${{env.IMAGE}}:${{env.TAG}}
${{secrets.DOCKER_REGISTRY}}/${{env.IMAGE}}:latest
deploy-to-production:
if: ${{ always() && needs.build-docker-image.result == 'success' }}
needs: build-docker-image
runs-on: node20
steps:
- name: Checkout infrastructure config
run: |
git clone -v --depth=1 ${{ env.REPOSITORY_URL }} infra
env:
REPOSITORY_URL: ${{ env.GIT_REPO_USER }}@${{ env.GIT_REPO_INTERNAL }}:${{ env.DEVSOAP_INFRA_GIT_REPO }}
- name: Setup Git config
working-directory: infra
run: |
git config user.email "code@devsoap.com"
git config user.name "Devsoap Code CI/CD"
- name: Update image version
working-directory: infra
run: |
sed -i -r "s|/$IMAGE:(.*?)|/$IMAGE:$TAG|g" $ENDPOINT/$STACK/docker-compose.yml
git diff -U0
- name: Push changes
working-directory: infra
run: |
git commit -am "Updated $ENDPOINT/$STACK/$IMAGE to $TAG"
git push origin master