Skip to content

Thyseus 14

Thyseus 14 #34

Workflow file for this run

name: Build Host Docker Image (dev)
on:
push:
branches:
- dev
paths:
- .github/workflows/build-host-dev.yml
- apps/host/src/**/*
- apps/host/Dockerfile
- apps/host/package.json
pull_request:
branches:
- dev
paths:
- .github/workflows/build-host-dev.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
flavor: |
latest=false
tags: |
type=raw,value=dev
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.DEVHOST_HOST }}
username: ${{ secrets.DEVHOST_USERNAME }}
key: ${{ secrets.DEVHOST_KEY }}
script: sh /home/deploy.sh