ci: fix test on deploy yml #64
Workflow file for this run
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
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy | |
# More GitHub Actions for Azure: https://github.com/Azure/actions | |
name: Deploy Stack | |
on: | |
push: | |
tags: | |
- "v*" | |
workflow_dispatch: | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: echo {{ secrets.NPMRC }} > src/web-api/.npmrc | |
- name: Test api | |
working-directory: ./src/web-api | |
run: npm run docker:test | |
build-client-ui: | |
needs: test | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CONTAINER_USERNAME }} | |
password: ${{ secrets.CONTAINER_PASSWORD }} | |
- name: UI - Build and Push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ secrets.REPOSITORY_NAME }}/ppo-ui:${{ github.ref_name }},${{ secrets.REPOSITORY_NAME }}/ppo-ui:stable | |
context: ./src/ui | |
secrets: | | |
npmrc=${{ secrets.NPMRC }} | |
build-calc-odds-api: | |
needs: test | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CONTAINER_USERNAME }} | |
password: ${{ secrets.CONTAINER_PASSWORD }} | |
- name: CalcOdds Api - Build and Push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ secrets.REPOSITORY_NAME }}/ppo-calc-odds:${{ github.ref_name }},${{ secrets.REPOSITORY_NAME }}/ppo-calc-odds:stable | |
context: ./src/calc-odds-api | |
secrets: | | |
npmrc=${{ secrets.NPMRC }} | |
build-web-api: | |
needs: test | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CONTAINER_USERNAME }} | |
password: ${{ secrets.CONTAINER_PASSWORD }} | |
- name: Web Api - Build and Push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ secrets.REPOSITORY_NAME }}/ppo-api:${{ github.ref_name }},${{ secrets.REPOSITORY_NAME }}/ppo-api:stable | |
context: ./src/web-api | |
secrets: | | |
npmrc=${{ secrets.NPMRC }} | |
migrate-db: | |
needs: [build-client-ui, build-web-api, build-calc-odds-api] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run migrations | |
working-directory: ./src/web-api | |
env: | |
DB_CONNECTION_STRING: ${{ secrets.DB_CONNECTION_STRING }} | |
run: npx prisma migrate deploy | |
deploy: | |
needs: migrate-db | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Log in to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CONTAINER_USERNAME }} | |
password: ${{ secrets.CONTAINER_PASSWORD }} | |
- run: | | |
docker pull ${{ secrets.REPOSITORY_NAME }}/ppo-ui:${{ github.ref_name }} | |
docker pull ${{ secrets.REPOSITORY_NAME }}/ppo-api:${{ github.ref_name }} | |
docker pull ${{ secrets.REPOSITORY_NAME }}/ppo-calc-odds:${{ github.ref_name }} | |
- name: deploy ui | |
run: | | |
flyctl deploy --image ${{ secrets.REPOSITORY_NAME }}/ppo-ui:${{ github.ref_name }} \ | |
--local-only src/ui \ | |
--image-label ${{ github.ref_name }} | |
- name: deploy api | |
run: | | |
flyctl deploy --image ${{ secrets.REPOSITORY_NAME }}/ppo-api:${{ github.ref_name }} \ | |
--local-only src/web-api \ | |
--image-label ${{ github.ref_name }} | |
- name: deploy calc-odds | |
run: | | |
flyctl deploy --image ${{ secrets.REPOSITORY_NAME }}/ppo-calc-odds:${{ github.ref_name }} \ | |
--local-only src/calc-odds-api \ | |
--image-label ${{ github.ref_name }} |