49 lines
1.2 KiB
YAML
49 lines
1.2 KiB
YAML
name: Build and deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
push: true
|
|
tags: smallbuster/fe-docs:latest
|
|
deploy:
|
|
runs-on: self-hosted
|
|
needs: build
|
|
steps:
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Pull Docker image from Docker Hub
|
|
run: |
|
|
docker pull smallbuster/fe-docs:latest
|
|
|
|
- name: Stop and remove existing container
|
|
run: |
|
|
docker stop fe-docs || true && docker rm fe-docs || true
|
|
|
|
- name: Run Docker container
|
|
run: |
|
|
docker run -d --restart unless-stopped \
|
|
--name fe-docs smallbuster/fe-docs:latest
|