2024-04-22 00:14:57 +02:00
|
|
|
name: Build and publish Docker image
|
2024-06-01 14:49:57 +02:00
|
|
|
|
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
|
|
|
|
2024-06-01 14:49: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 }}
|
|
|
|
|
2024-06-01 14:49:57 +02:00
|
|
|
- name: Extract tag for kaniko action
|
|
|
|
id: tag
|
|
|
|
env:
|
2024-06-01 17:41:11 +02:00
|
|
|
TAG: ${{ steps.meta.outputs.tags }}
|
2024-06-01 14:49:57 +02:00
|
|
|
run: |
|
2024-06-01 17:41:11 +02:00
|
|
|
echo "TAG=$TAG"
|
2024-06-01 14:49:57 +02:00
|
|
|
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:
|
2024-06-01 14:49:57 +02:00
|
|
|
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) }}
|
2024-05-19 20:40:20 +02:00
|
|
|
|
|
|
|
- name: Trigger redeployment
|
2024-06-01 17:41:02 +02:00
|
|
|
if: gitea.ref == format('refs/heads/{0}', gitea.event.repository.default_branch)
|
2024-05-19 20:40:20 +02:00
|
|
|
env:
|
|
|
|
UPDATE_URL: ${{ secrets.UPDATE_URL }}
|
|
|
|
UPDATE_TOKEN: ${{ secrets.UPDATE_TOKEN }}
|
|
|
|
run: |
|
2024-12-03 23:48:41 +01:00
|
|
|
curl --fail-with-body "$UPDATE_URL" -H "Authorization: Bearer ${UPDATE_TOKEN}"
|