dumili: wip #703
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 | |
permissions: | |
contents: write | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "master" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: production | |
env: | |
REMOTE_ROOT: workspace/DucksManager2 | |
PRODUCTION_SSH_HOST: ${{ secrets.PRODUCTION_SSH_HOST }} | |
PRODUCTION_SSH_USER: ${{ secrets.PRODUCTION_SSH_USER }} | |
PRODUCTION_SSH_KEY: ${{ secrets.PRODUCTION_SSH_KEY }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
GH_TOKEN: ${{ github.token }} | |
name: deploy | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ghcr.io | |
username: bperel | |
password: ${{ secrets.DOCKER_REGISTRY_TOKEN_DM }} | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v4 | |
with: | |
main-branch-name: master | |
# fallback-sha: "ffffff" | |
- run: | | |
echo "HEAD: ${{ env.NX_HEAD }}" | |
echo "BASE: ${{ env.NX_BASE }}" | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9.8.0 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
- uses: oven-sh/setup-bun@v1 | |
- name: Check apps changed since the last successful commit | |
run: | | |
if [ "${{ env.NX_BASE }}" == "ffffff" ]; then | |
lastSuccessfulCommit=${{ env.NX_HEAD }} | |
else | |
lastSuccessfulCommit=${{ env.NX_BASE }} | |
fi | |
echo "lastSuccessfulCommit=$lastSuccessfulCommit" >> "$GITHUB_ENV" | |
echo "Changed apps:" | |
pnpm -r -F "...[$lastSuccessfulCommit]" ls --depth -1 | |
- name: Install dependencies | |
run: | | |
pnpm -r i | |
- name: Retrieve pre-build files | |
run: | | |
pnpm i -g turbo | |
turbo -F "...[$lastSuccessfulCommit]" -F '!~dumili' -F '!~dumili-api' prod:transfer-files-pre | |
- name: Build apps | |
run: | | |
turbo -F "...[$lastSuccessfulCommit]" -F '!~dumili' -F '!~dumili-api' build | |
- uses: docker/setup-buildx-action@v3 | |
- name: Build and push Docker images | |
run: | | |
turbo -F "...[$lastSuccessfulCommit]" -F '!~ci' -F '!~dumili' -F '!~dumili-api' prod:build-docker | |
- name: Send post-build files | |
run: | | |
turbo -F "...[$lastSuccessfulCommit]" -F '!~ci' -F '!~dumili' -F '!~dumili-api' prod:transfer-files-post | |
- name: Deploy | |
run: | | |
turbo --concurrency=1 -F "...[$lastSuccessfulCommit]" -F '!~ci' -F '!~dumili' -F '!~dumili-api' prod:deploy |