https everywhere #167
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |