Add workflow to build and push Docker image
All checks were successful
Push Workflows / docker-build (push) Successful in 5m28s
All checks were successful
Push Workflows / docker-build (push) Successful in 5m28s
This commit is contained in:
parent
a62aa86afe
commit
19454b8a70
36
.gitea/workflows/push.yaml
Normal file
36
.gitea/workflows/push.yaml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
name: Push Workflows
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Login to Gitea container registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.registry }}
|
||||||
|
username: ${{ env.actions_user }}
|
||||||
|
password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
|
||||||
|
- name: Get Image Name
|
||||||
|
id: get-image-name
|
||||||
|
run: |
|
||||||
|
echo "IMAGE_NAME=$(echo ${{ env.registry }}/${{ gitea.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: "${{ steps.get-image-name.outputs.IMAGE_NAME }}:${{ gitea.sha }}"
|
||||||
|
cache-from: type=registry,ref=${{ steps.get-image-name.outputs.IMAGE_NAME }}:${{ gitea.sha }}
|
||||||
|
cache-to: type=inline
|
||||||
|
- name: Build and push Docker image with "latest" tag
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
if: gitea.ref == 'refs/heads/main'
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: "${{ steps.get-image-name.outputs.IMAGE_NAME }}:latest"
|
||||||
|
cache-from: type=registry,ref=${{ steps.get-image-name.outputs.IMAGE_NAME }}:latest
|
||||||
|
cache-to: type=inline
|
Loading…
x
Reference in New Issue
Block a user