feat: Add automated LiteFS backups and GitHub deployment workflow
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 3m52s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 3m52s
This commit is contained in:
50
.github/workflows/deploy.yml
vendored
Normal file
50
.github/workflows/deploy.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
name: Deploy to Nomad
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Build and Push Docker Image"]
|
||||
types:
|
||||
- completed
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
container_sha:
|
||||
description: 'Container SHA to deploy (leave empty for latest commit)'
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
nomad:
|
||||
runs-on: ubuntu-latest
|
||||
name: Deploy to Nomad
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Nomad CLI
|
||||
uses: hashicorp/setup-nomad@v2
|
||||
with:
|
||||
version: '1.10.5'
|
||||
|
||||
- name: Set Container Version
|
||||
id: container_version
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.container_sha }}" ]; then
|
||||
echo "sha=${{ inputs.container_sha }}" >> $GITHUB_OUTPUT
|
||||
elif [ "${{ github.event_name }}" = "workflow_run" ]; then
|
||||
echo "sha=${{ github.event.workflow_run.head_sha }}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "sha=${{ github.sha }}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Deploy Nomad Job
|
||||
id: deploy
|
||||
env:
|
||||
NOMAD_ADDR: http://192.168.4.36:4646
|
||||
NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }}
|
||||
run: |
|
||||
echo "Deploying container version: ${{ steps.container_version.outputs.sha }}"
|
||||
nomad job run \
|
||||
-var="container_sha=${{ steps.container_version.outputs.sha }}" \
|
||||
navidrome-litefs.nomad
|
||||
Reference in New Issue
Block a user