Skip to content

Update workflow

Update workflow #7

Workflow file for this run

name: Build and Deploy on Push
on:
push:
branches:
- master
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Docker Image
run: |
COMMIT_HASH=$(echo $GITHUB_SHA | cut -c1-7)
docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 \
-t devinfritz/vzbot-web-nuxt:stage-${COMMIT_HASH} --push .
execute:
runs-on: ubuntu-latest
steps:
- name: install ssh keys
# check this thread to understand why its needed:
# https://stackoverflow.com/a/70447517
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.SERVER_SSH_KEY }}" > ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SERVER_SSH_PORT }} > ~/.ssh/known_hosts
- name: connect and pull
run: ssh ${{ secrets.SERVER_SSH_USERNAME }}@${{ secrets.SERVER_SSH_PORT }} "mkdir worked"
- name: cleanup
run: rm -rf ~/.ssh