1
0
Fork 0
newpipe-ev-website/.gitea/workflows/docker.yml

55 lines
1.6 KiB
YAML
Raw Normal View History

2024-04-22 00:14:57 +02:00
name: Build and publish Docker image
2024-05-20 00:44:15 +02:00
on:
push:
pull_request:
workflow_dispatch:
2024-04-22 00:14:57 +02:00
env:
REGISTRY: git.newpipe-ev.de
# make sure the name is lowercase, otherwise Docker won't accept it
IMAGE_NAME: newpipe-ev/website
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
2024-08-21 00:39:41 +02:00
- uses: actions/checkout@v4
2024-04-22 00:14:57 +02:00
- name: Generate suitable tag for kaniko
2024-04-22 00:14:57 +02:00
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Extract tag for kaniko action
id: tag
env:
2024-06-01 17:41:11 +02:00
TAG: ${{ steps.meta.outputs.tags }}
run: |
2024-06-01 17:41:11 +02:00
echo "TAG=$TAG"
echo "::set-output name=tag::${TAG##*:}"
- name: Build Docker image with kaniko
uses: https://code.thetadev.de/ThetaDev/action-kaniko@dbb8da86cf2d498dde8ec1b3be967ceda17a21ff
2024-04-22 00:14:57 +02:00
with:
image: ${{ env.IMAGE_NAME }}
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tag: ${{ steps.tag.outputs.tag }}
platforms: linux/amd64
2024-06-01 17:41:02 +02:00
tag_with_latest: ${{ gitea.ref == format('refs/heads/{0}', gitea.event.repository.default_branch) }}
- name: Trigger redeployment
2024-06-01 17:41:02 +02:00
if: gitea.ref == format('refs/heads/{0}', gitea.event.repository.default_branch)
env:
UPDATE_URL: ${{ secrets.UPDATE_URL }}
UPDATE_TOKEN: ${{ secrets.UPDATE_TOKEN }}
run: |
curl "$UPDATE_URL" -H "Authorization: Bearer ${UPDATE_TOKEN}"