Deploying to staging triggered by Allimonae #63
This file contains hidden or 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 | |
| run-name: Deploying to staging triggered by ${{ github.actor }} | |
| concurrency: | |
| group: deploy-staging | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| statuses: write | |
| checks: write | |
| jobs: | |
| backendPretest: | |
| name: Backend Pretests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Run workflow | |
| uses: ./.github/composite/test/backend-pretest | |
| frontendPretest: | |
| name: Frontend Pretests | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: js | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Run workflow | |
| uses: ./.github/composite/test/frontend-pretest | |
| backendTest: | |
| name: Backend Tests | |
| runs-on: ubuntu-latest | |
| needs: backendPretest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| - name: Run workflow | |
| uses: ./.github/composite/test/backend-test | |
| frontendTest: | |
| name: Frontend Tests | |
| runs-on: ubuntu-latest | |
| needs: frontendPretest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| - name: Run workflow | |
| uses: ./.github/composite/test/frontend-test | |
| runLocalDb: | |
| name: Test Run Database Locally | |
| runs-on: ubuntu-latest | |
| needs: backendTest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for database changes | |
| id: dbChanges | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" != "push" ]; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| if git diff --quiet "${{ github.event.before }}" "${{ github.sha }}" -- db; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Run workflow | |
| if: steps.dbChanges.outputs.changed == 'true' | |
| uses: ./.github/composite/db/run-local-db | |
| - name: Skipping database test | |
| if: steps.dbChanges.outputs.changed != 'true' | |
| shell: bash | |
| run: echo "skipping db test" | |
| runBackendInstance: | |
| name: Test Run Backend Instance | |
| runs-on: ubuntu-latest | |
| needs: backendTest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| - name: Run workflow | |
| uses: ./.github/composite/run-backend-instance | |
| buildImage: | |
| name: Build Docker Image & Upload to Registry | |
| runs-on: ubuntu-latest | |
| needs: [frontendTest, runLocalDb, runBackendInstance] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup CI | |
| uses: ./.github/composite/setup-ci | |
| with: | |
| SECRETS: ${{ toJSON(secrets) }} | |
| - name: Run workflow | |
| uses: ./.github/composite/build-image | |
| with: | |
| ENVIRONMENT: staging | |
| migrateDatabase: | |
| name: Migrate Staging Database | |
| runs-on: ubuntu-latest | |
| needs: [buildImage] | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.sha }} | |
| fetch-depth: 0 | |
| - name: Setup CI | |
| uses: ./.github/composite/setup-ci | |
| with: | |
| SECRETS: ${{ toJSON(secrets) }} | |
| - name: Run workflow | |
| uses: ./.github/composite/db/migrate | |
| with: | |
| ENVIRONMENT: staging | |
| updateK8sTag: | |
| name: Change Tag in K8s | |
| runs-on: ubuntu-latest | |
| needs: [migrateDatabase] | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| - name: Setup CI | |
| uses: ./.github/composite/setup-ci | |
| with: | |
| SECRETS: ${{ toJSON(secrets) }} | |
| - name: Run Workflow | |
| uses: ./.github/composite/update-tag | |
| with: | |
| ENVIRONMENT: staging |