2025-12-01 07:32:24 -05:00
|
|
|
name: Build and Push Docker Image
|
2025-12-01 01:09:53 -05:00
|
|
|
|
2025-12-01 07:32:24 -05:00
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
branches:
|
|
|
|
|
- main
|
2025-12-01 01:09:53 -05:00
|
|
|
|
2025-12-01 07:32:24 -05:00
|
|
|
jobs:
|
|
|
|
|
build-and-push:
|
|
|
|
|
runs-on: ubuntu-latest
|
2025-12-01 07:34:14 -05:00
|
|
|
container: docker:latest
|
2025-12-01 01:09:53 -05:00
|
|
|
|
2025-12-01 07:32:24 -05:00
|
|
|
steps:
|
|
|
|
|
- name: Checkout repository
|
2025-12-01 07:35:22 -05:00
|
|
|
run: |
|
|
|
|
|
git clone ${{ github.server_url }}/${{ github.repository }} .
|
|
|
|
|
git checkout ${{ github.sha }}
|
2025-12-01 01:09:53 -05:00
|
|
|
|
2025-12-01 07:32:24 -05:00
|
|
|
- name: Log in to Forgejo Container Registry
|
2025-12-01 07:56:11 -05:00
|
|
|
run: |
|
|
|
|
|
echo "Logging in as: ${{ github.actor }}"
|
|
|
|
|
echo "${{ secrets.FORGEJO_TOKEN }}" | docker login forgejo.sivic.me -u ${{ github.actor }} --password-stdin
|
|
|
|
|
echo "Login exit code: $?"
|
2025-12-01 01:09:53 -05:00
|
|
|
|
2025-12-01 07:32:24 -05:00
|
|
|
- name: Build and push Docker images
|
|
|
|
|
run: |
|
|
|
|
|
docker build \
|
|
|
|
|
-t forgejo.sivic.me/${{ github.repository }}:latest \
|
|
|
|
|
-t forgejo.sivic.me/${{ github.repository }}:${{ github.sha }} \
|
|
|
|
|
.
|
|
|
|
|
docker push forgejo.sivic.me/${{ github.repository }}:latest
|
|
|
|
|
docker push forgejo.sivic.me/${{ github.repository }}:${{ github.sha }}
|
|
|
|
|
|
|
|
|
|
- name: Summary
|
|
|
|
|
run: |
|
|
|
|
|
echo "✅ Successfully built and pushed:"
|
|
|
|
|
echo " - forgejo.sivic.me/${{ github.repository }}:latest"
|
|
|
|
|
echo " - forgejo.sivic.me/${{ github.repository }}:${{ github.sha }}"
|