Skip to content

Testtribe 2025

Testtribe 2025 #116

Workflow file for this run

name: Api CI/CD
permissions:
id-token: write
on:
push:
paths:
- 'api/**'
- 'TwoWeeksReady.Common/**'
- '.github/workflows/api.yaml'
branches: [ main ]
pull_request:
paths:
- 'api/**'
- '.github/workflows/api.yaml'
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Build
run: dotnet build -c Release
working-directory: ./api
- name: Publish
run: dotnet publish -c Release
working-directory: ./api
- name: Zip Functions Package
run: zip -r ../deploy.zip ./
working-directory: ./api/TwoWeeksReady/bin/Release/net6.0/publish/
- name: Upload Deployment Zip
uses: actions/upload-artifact@v2
with:
name: deployment_zip
path: ./api/TwoWeeksReady/bin/Release/net6.0/deploy.zip
- name: Upload Deployment Script
uses: actions/upload-artifact@v2
with:
name: deployment_script
path: ./az/deploy-backend.sh
deploy_to_dev:
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'pull_request'
environment: development
steps:
- name: Download a Deployment Zip
uses: actions/download-artifact@v2
with:
name: deployment_zip
- name: Download a Deployment Script
uses: actions/download-artifact@v2
with:
name: deployment_script
- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Azure Deploy Resources
if: github.event_name != 'pull_request'
uses: Azure/[email protected]
with:
inlineScript: |
chmod +x ./deploy-backend.sh
./deploy-backend.sh -z deploy.zip
deploy_to_beta:
runs-on: ubuntu-latest
needs: deploy_to_dev
if: github.event_name != 'pull_request'
environment: beta
steps:
- name: Download a Deployment Zip
uses: actions/download-artifact@v2
with:
name: deployment_zip
- name: Download a Deployment Script
uses: actions/download-artifact@v2
with:
name: deployment_script
- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Azure Deploy Resources
if: github.event_name != 'pull_request'
uses: Azure/[email protected]
with:
inlineScript: |
chmod +x ./deploy-backend.sh
./deploy-backend.sh -z deploy.zip -r 2wr-beta-resources -e 2wrbeta