Revamp commit UI/UX #66
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy to testing server | |
on: [push, pull_request] | |
jobs: | |
build-docker: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: docker | |
- name: Build production environment using docker-compose | |
run: | | |
docker compose -f docker-compose.yml -f docker-compose.caddy.yml build production | |
- name: Save Docker image as a tarball | |
run: docker save bxt_production:latest -o bxt-production.tar | |
- name: Upload Docker image to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bxt-production-image | |
path: | | |
bxt-production.tar | |
docker-compose.yml | |
docker-compose.caddy.yml | |
deploy-ssh: | |
name: Deploy to server using ssh | |
needs: build-docker | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' && github.repository == 'anydistro/bxt' | |
steps: | |
- name: Download Docker image from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: bxt-production-image | |
path: distfiles | |
- name: Transfer Docker image to server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEPLOYMENT_SERVER_HOST }} | |
username: ${{ secrets.DEPLOYMENT_SERVER_USER }} | |
key: ${{ secrets.DEPLOYMENT_SERVER_SSH_KEY }} | |
source: distfiles/* | |
target: "/tmp/bxt/" | |
- name: Deploy Docker image on server | |
uses: appleboy/[email protected] | |
env: | |
CADDY_HOST: ${{ secrets.DEPLOYMENT_SERVER_HOST }} | |
with: | |
host: ${{ secrets.DEPLOYMENT_SERVER_HOST }} | |
username: ${{ secrets.DEPLOYMENT_SERVER_USER }} | |
key: ${{ secrets.DEPLOYMENT_SERVER_SSH_KEY }} | |
envs: CADDY_HOST | |
script: | | |
cd /tmp/bxt/distfiles/ | |
docker compose -f docker-compose.yml -f docker-compose.caddy.yml down production || true | |
docker load -i bxt-production.tar | |
docker compose -f docker-compose.yml -f docker-compose.caddy.yml -p bxt up -d production |