Make docker build and push task runnable in CI #8
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: 'Production deployment' | |
#on: [workflow_dispatch] | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
buildandpush: | |
name: 'Build and push docker images' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: 'actions/checkout@v4' | |
with: | |
fetch-depth: 0 | |
- name: Set up Moon Toolchain | |
uses: 'moonrepo/setup-toolchain@v0' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
env: | |
FONTAWESOME_PACKAGE_TOKEN: ${{ secrets.FONTAWESOME_PACKAGE_TOKEN }} | |
run: 'moon ci :docker-push --log trace' | |
deploy: | |
name: 'Deploy to VPS' | |
runs-on: ubuntu-latest | |
needs: buildandpush | |
steps: | |
- uses: 'actions/checkout@v4' | |
with: | |
fetch-depth: 0 | |
- name: Set up Moon Toolchain | |
uses: 'moonrepo/setup-toolchain@v0' | |
- name: 'Redeploy from Dokploy on VPS' | |
env: | |
DOKPLOY_API_TOKEN: ${{ secrets.DOKPLOY_API_TOKEN }} | |
DOKPLOY_DEPLOY_ENDPOINT: ${{ secrets.DOKPLOY_DEPLOY_ENDPOINT }} | |
run: 'moon ci :dokploy-deploy --log trace' |