Skip to content

Commit

Permalink
Add GitHub Actions workflow to build/deploy on tag
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanweeks committed Jan 20, 2022
1 parent 4c478a1 commit ba24088
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
push:
tags:
- '**'

jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Add SSH key
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
chmod 700 ${HOME}
mkdir -m 700 -p ${HOME}/.ssh
echo '${{ secrets.DOCKER_SSH_CONFIG }}' > ${HOME}/.ssh/config
echo '${{ secrets.DOCKER_SSH_KNOWN_HOSTS }}' >> ${HOME}/.ssh/known_hosts
chmod 400 ${HOME}/.ssh/*
ssh-agent -a ${SSH_AUTH_SOCK} > /dev/null
ssh-add - <<< '${{ secrets.DOCKER_HOST_SSH_PRIVATE_KEY }}'
- name: Build container image and deploy image
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
DOCKER_BUILDKIT: 1
DOCKER_HOST: ssh://docker
run: docker compose up --detach --build --force-recreate --renew-anon-volumes

0 comments on commit ba24088

Please sign in to comment.