tera-app / clean comments #85
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: 'Deploy to staging' | |
env: | |
FONTAWESOME_PACKAGE_TOKEN: ${{ secrets.FONTAWESOME_PACKAGE_TOKEN }} | |
REGISTRY: ghcr.io | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
define-matrix: | |
name: 'Define projects to run' | |
runs-on: ubuntu-latest | |
outputs: | |
projects: ${{ steps.projects.outputs.projects }} | |
steps: | |
- uses: 'actions/checkout@v4' | |
with: | |
fetch-depth: 0 | |
- name: Set up Moon Toolchain | |
uses: 'moonrepo/setup-toolchain@v0' | |
- name: Define Projects | |
id: projects | |
run: | | |
echo "projects=$(moon query projects projectType=application --affected | sed 's/ |/|/g' | awk -F '|' '{print "\"" $1 "\""}' | paste -sd, - | sed 's/^/\[/; s/$/\]/')" >> "$GITHUB_OUTPUT" | |
build-and-push: | |
name: '${{ matrix.projects }} | Build and push docker images' | |
needs: define-matrix | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: | |
projects: ${{ fromJSON(needs.define-matrix.outputs.projects) }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: 'actions/checkout@v4' | |
with: | |
fetch-depth: 0 | |
- name: Set up Moon Toolchain | |
uses: 'moonrepo/setup-toolchain@v0' | |
with: | |
auto-install: true | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push docker images | |
run: 'moon ci ${{ matrix.projects }}:staging-docker-push' | |
deploy: | |
name: 'Deploy to VPS' | |
runs-on: ubuntu-latest | |
needs: | |
- define-matrix | |
- build-and-push | |
strategy: | |
fail-fast: false | |
matrix: | |
projects: ${{ fromJSON(needs.define-matrix.outputs.projects) }} | |
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_API_URL: ${{ secrets.DOKPLOY_API_URL }} | |
run: 'moon ci ${{ matrix.projects }}:staging-dokploy-compose-deploy' |