Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
steps:
- uses: actions/checkout@v2
- run: yarn install
- run: yarn test
- run: yarn docker:build
- run: yarn docker:login
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- run: yarn docker:push
# this action will ssh into VPS then run 3 commands:
# docker pull name/label:latest => pull image from docker
# docker tag name/label:latest dokku/prod:latest => tag image (this is needed for dokku)
# dokku tags:deploy prod latest => dokku deploys that docker image
- name: deploy to dokku
uses: fifsky/ssh-action@master
with:
command: docker pull name/label:latest && docker tag name/label:latest dokku/prod:latest && dokku tags:deploy prod latest
host: ${{ secrets.SSH_HOST }}
user: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
{
"scripts":{
"docker:build":"docker build -t name/label:latest .",
"docker:login":"docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD",
"docker:push":"docker push name/label:latest"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment