Skip to content

Commit

Permalink
Updated CI pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
loffa committed Apr 17, 2024
1 parent ec8ac04 commit bb30ac7
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
name: Build & Deploy
name: Build
on:
push:
branches:
- master
- master

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Build container
id: docker_build
uses: docker/build-push-action@v2
with:
load: true
tags: insektionen/x32-mqtt:latest
- name: Export container
run: docker save insektionen/x32-mqtt:latest | gzip > x32-mqtt_latest.tar.gz
- name: Copy to Server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: 22
source: "x32-mqtt_latest.tar.gz"
target: "~/"
- name: Import and start on Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: 22
script: docker load < x32-mqtt_latest.tar.gz && cd x32-mqtt && docker-compose up -d
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build container
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit bb30ac7

Please sign in to comment.