Merge pull request #12 from uw935/feature/deploy-by-package

added deploy using github packages
This commit is contained in:
Mark
2024-04-14 20:22:55 +03:00
committed by GitHub
+34 -14
View File
@@ -1,23 +1,43 @@
name: deployment on server name: Create and publish a Docker image
on: on:
push: push:
branches: [ master ] branches:
- master
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs: jobs:
build: build-and-push-image:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: permissions:
- uses: actions/checkout@v3 contents: read
packages: write
- name: update bot steps:
uses: appleboy/ssh-action@v1.0.3 - name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with: with:
host: ${{ secrets.SERVER_HOST }} registry: ${{ env.REGISTRY }}
username: ${{ secrets.SERVER_USER }} username: ${{ github.actor }}
key: ${{ secrets.SSH_PRIVATE_KEY }} password: ${{ secrets.GITHUB_TOKEN }}
port: 22
script: | - name: Extract metadata (tags, labels) for Docker
cd /home/deploy/vatsimfox && git pull origin master --force && cd /home/deploy/vatsimfox/src id: meta
docker compose up -d --build uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: src/.
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}