93 lines
2.7 KiB
YAML
93 lines
2.7 KiB
YAML
name: deploy media-proxy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- fluxer_media_proxy/**
|
|
- .github/workflows/deploy-media-proxy.yaml
|
|
workflow_dispatch:
|
|
inputs:
|
|
ref:
|
|
type: string
|
|
required: false
|
|
default: ''
|
|
description: Optional git ref (defaults to the triggering branch)
|
|
|
|
concurrency:
|
|
group: deploy-fluxer-media-proxy
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
SERVICE_NAME: fluxer-media-proxy
|
|
IMAGE_NAME: fluxer-media-proxy
|
|
CONTEXT_DIR: fluxer_media_proxy
|
|
COMPOSE_STACK: fluxer-media-proxy
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Deploy media proxy
|
|
runs-on: blacksmith-8vcpu-ubuntu-2404
|
|
timeout-minutes: 25
|
|
env:
|
|
RELEASE_CHANNEL: stable
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ inputs.ref || '' }}
|
|
|
|
- name: Record deploy commit
|
|
run: python3 scripts/ci/workflows/deploy_media_proxy.py --step record_deploy_commit
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
|
|
- name: Set build timestamp
|
|
run: python3 scripts/ci/workflows/deploy_media_proxy.py --step set_build_timestamp
|
|
|
|
- name: Build image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ${{ env.CONTEXT_DIR }}/Dockerfile
|
|
tags: ${{ env.IMAGE_NAME }}:${{ env.DEPLOY_SHA }}
|
|
load: true
|
|
platforms: linux/amd64
|
|
cache-from: type=gha,scope=${{ env.SERVICE_NAME }}
|
|
cache-to: type=gha,mode=max,scope=${{ env.SERVICE_NAME }}
|
|
build-args: |
|
|
BUILD_SHA=${{ env.DEPLOY_SHA }}
|
|
BUILD_NUMBER=${{ github.run_number }}
|
|
BUILD_TIMESTAMP=${{ env.BUILD_TIMESTAMP }}
|
|
RELEASE_CHANNEL=${{ env.RELEASE_CHANNEL }}
|
|
env:
|
|
DOCKER_BUILD_SUMMARY: false
|
|
DOCKER_BUILD_RECORD_UPLOAD: false
|
|
|
|
- name: Install docker-pussh
|
|
run: python3 scripts/ci/workflows/deploy_media_proxy.py --step install_docker_pussh
|
|
|
|
- name: Set up SSH agent
|
|
uses: webfactory/ssh-agent@v0.9.1
|
|
with:
|
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY_SERVER }}
|
|
|
|
- name: Add server to known hosts
|
|
run: python3 scripts/ci/workflows/deploy_media_proxy.py --step add_known_hosts --server-ip ${{ secrets.SERVER_IP }}
|
|
|
|
- name: Push image and deploy
|
|
env:
|
|
IMAGE_TAG: ${{ env.IMAGE_NAME }}:${{ env.DEPLOY_SHA }}
|
|
SERVER: ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}
|
|
run: python3 scripts/ci/workflows/deploy_media_proxy.py --step push_and_deploy
|