Skip to content

marcpartensky.com also #166

marcpartensky.com also

marcpartensky.com also #166

Workflow file for this run

name: Docker
on:
push:
branches:
- master
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
env:
IMAGE_NAME: website
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the tag
id: tag
run: echo "::set-output name=tag::$(git rev-parse --short HEAD).$(date +'%Y-%m-%d')"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: marcpartensky/website:latest
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: marcpartensky/website:v${{ github.run_number }}.${{ steps.tag.outputs.tag }}
deploy:
runs-on: ubuntu-latest
needs:
- build-and-push
steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
cd ~/git/docker/services
docker compose -f website.yml pull
docker compose -f website.yml up -d