Skip to content

Applying Stash

Applying Stash #84

Workflow file for this run

name: Baphomet Server Deploy
on:
push:
branches:
- master
jobs:
build:
runs-on: self-hosted
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.SSL_CERT }}" >> ~/.env
echo "SSL_PRIVATE_KEY=${{ secrets.SSL_PRIVATE_KEY }}" >> ~/.env
echo "SSL_CERT_INTERMEDIATE=${{ secrets.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
Write-Output "Docker Compose Installed"
} else {
Write-Output "Docker Compose already installed"
}
- name: Debug Docker Hub Login
shell: powershell
run: |
Start-Process -FilePath "docker" -ArgumentList "logout" -NoNewWindow
Write-Output "Logging into Docker Hub..."
Start-Process -FilePath "docker" -ArgumentList "login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}" -NoNewWindow
Write-Output "Docker login completed."
- 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
Write-Output "Docker Compose Installed"
} else {
Write-Output "Docker Compose already installed"
}
- 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