Files
trips/.gitea/workflows/main-image.yml
Shaun Campbell 188912c8af
All checks were successful
PR Checks / lint-test-and-docker-build (pull_request) Successful in 2m5s
ci) Updating merge image task
2026-02-20 23:39:51 -05:00

53 lines
1.6 KiB
YAML

name: Build and Push Image
on:
push:
branches:
- main
env:
REGISTRY_HOST: git.campbellwireless.net
IMAGE_NAME: ${{ github.repository }}
jobs:
docker-build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
env:
REPO_URL: https://cloud.campbellwireless.net/git/${{ github.repository }}.git
run: |
set -eux
git init .
git remote add origin "$REPO_URL"
auth="$(printf '%s' '${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}' | base64 | tr -d '\n')"
git config --local http.https://cloud.campbellwireless.net/.extraheader "AUTHORIZATION: basic $auth"
git fetch --prune --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*
git checkout --detach "${{ github.sha }}"
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Gitea registry
uses: docker/login-action@v3
with:
registry: cloud.campbellwireless.net/git
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Compute image tags
id: tags
run: |
echo "sha_short=$(echo '${{ github.sha }}' | cut -c1-12)" >> "$GITHUB_OUTPUT"
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ env.REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.sha_short }}