Skip to content

Merge branch 'master' of https://github.com/collinlucke/baphomet-server #74

Merge branch 'master' of https://github.com/collinlucke/baphomet-server

Merge branch 'master' of https://github.com/collinlucke/baphomet-server #74

Workflow file for this run

name: Deploy Baphomet Server
on:
push:
branches:
- master
jobs:
build:
runs-on: self-hosted # Use your self-hosted runner
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Set Environment Variables
shell: powershell
run: |
echo "ATLAS_DB_PASSWORD=${{ secrets.ATLAS_DB_PASSWORD }}" >> ~/.env
echo "ATLAS_DB_USERNAME=${{ secrets.ATLAS_DB_USERNAME }}" >> ~/.env
echo "ATLAS_CLUSTER=${{ secrets.ATLAS_CLUSTER }}" >> ~/.env
echo "ATLAS_DB=${{ secrets.ATLAS_DB }}" >> ~/.env
echo "ACCESS_TOKEN_SECRET=${{ secrets.ACCESS_TOKEN_SECRET }}" >> ~/.env
echo "REFRESH_TOKEN_SECRET=${{ secrets.REFRESH_TOKEN_SECRET }}" >> ~/.env
echo "SSL_CERT=${{ secrets.IONOS_SSL_CERT }}" >> ~/.env
echo "SSL_PRIVATE_KEY=${{ secrets.IONOS_SSL_PRIVATE_KEY }}" >> ~/.env
echo "SSL_CERT_INTERMEDIATE=${{ secrets.IONOS_SSL_CERT_INTERMEDIATE }}" >> ~/.env
- name: Install Docker Compose (if needed)
shell: powershell
run: |
if (-not (Get-Command docker-compose -ErrorAction SilentlyContinue)) {
$installPath = "${{ runner.temp }}/docker-compose.exe"
Invoke-WebRequest -Uri "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-Windows-x86_64.exe" -OutFile $installPath
Start-Process -FilePath "powershell.exe" -ArgumentList "-Command Move-Item -Path $installPath -Destination 'C:\Program Files\Docker\Docker\resources\bin\docker-compose.exe'" -Verb RunAs
}
- name: Login to Docker Hub
shell: powershell
run: Start-Process -FilePath "docker" -ArgumentList "login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}" -Verb RunAs
- name: Build Docker Images
shell: powershell
run: Start-Process -FilePath "docker-compose" -ArgumentList "-f docker-compose.yml build" -Verb RunAs
- name: Push Docker Images
shell: powershell
run: Start-Process -FilePath "docker-compose" -ArgumentList "-f docker-compose.yml push" -Verb RunAs
deploy:
needs: build
runs-on: self-hosted
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Install Docker Compose (if needed)
shell: powershell
run: |
if (-not (Get-Command docker-compose -ErrorAction SilentlyContinue)) {
$installPath = "${{ runner.temp }}/docker-compose.exe"
Invoke-WebRequest -Uri "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-Windows-x86_64.exe" -OutFile $installPath
Start-Process -FilePath "powershell.exe" -ArgumentList "-Command Move-Item -Path $installPath -Destination 'C:\Program Files\Docker\Docker\resources\bin\docker-compose.exe'" -Verb RunAs
}
- name: Pull Image from Docker Hub
shell: powershell
run: Start-Process -FilePath "docker-compose" -ArgumentList "-f docker-compose.yml pull" -Verb RunAs
- name: Delete Old Container
shell: powershell
run: Start-Process -FilePath "docker" -ArgumentList "rm -f baphomet-server-container" -Verb RunAs
- name: Run Docker Container
shell: powershell
run: Start-Process -FilePath "docker-compose" -ArgumentList "-f docker-compose.yml up -d" -Verb RunAs