Skip to content

Workflow file for this run

name: Build Host Docker Image
on:
push:
branches:
- main
paths:
- .github/workflows/build-host-main.yml
- apps/host/src/**/*
- apps/host/Dockerfile
- apps/host/package.json
tags:
- "host@*.*.*"
pull_request:
branches:
- main
paths:
- .github/workflows/build-host-main.yml
- apps/host/src/**/*
- apps/host/Dockerfile
- apps/host/package.json
env:
REGISTRY: ghcr.io
IMAGE_NAME: unavi-xyz/host
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the container registry
if: ${{ github.event_name == 'push' }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
org.opencontainers.image.description=Host server for The Wired
tags: |
type=edge
type=match,pattern=\d.\d.\d
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: apps/host/Dockerfile
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: SSH remote commands
if: ${{ github.event_name == 'push' }}
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST_HOST }}
username: ${{ secrets.HOST_USERNAME }}
key: ${{ secrets.HOST_KEY }}
script: sh /home/deploy.sh