Skip to content

Merge branch 'master' of https://github.com/hueckidom/ping-pong-game #37

Merge branch 'master' of https://github.com/hueckidom/ping-pong-game

Merge branch 'master' of https://github.com/hueckidom/ping-pong-game #37

Workflow file for this run

name: GitOps Pipeline
on:
push:
branches:
- master
env:
DOTNET_VERSION: "8.0"
jobs:
build_and_push_image:
name: Build and push image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Code from repository
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push service Docker image
uses: docker/build-push-action@v2
with:
context: ./service/src/PingPong
push: true
tags: ghcr.io/${{ github.repository }}-service:${{ github.sha }}
- name: Build and push client Docker image
uses: docker/build-push-action@v2
with:
context: ./client/
push: true
tags: ghcr.io/${{ github.repository }}-client:${{ github.sha }}
deploy:
name: Deploy app
needs: build_and_push_image
runs-on: ubuntu-latest
if: success()
steps:
- name: Checkout Code from repository
uses: actions/checkout@v2
- run: |
cd deployment/terraform
terraform init -backend-config "secret_key=$OBJECT_STORAGE_SECRET_KEY" -backend-config "access_key=$OBJECT_STORAGE_ACCESS_KEY"
terraform apply -auto-approve -var "service_account_token=$SERVICE_ACCOUNT_TOKEN" -var "object_storage_secret_key=$OBJECT_STORAGE_SECRET_KEY" -var "object_storage_access_key=$OBJECT_STORAGE_ACCESS_KEY" -var "image_tag=${{ github.sha }}"
env:
OBJECT_STORAGE_SECRET_KEY: ${{ secrets.OBJECT_STORAGE_SECRET_KEY }}
OBJECT_STORAGE_ACCESS_KEY: ${{ secrets.OBJECT_STORAGE_ACCESS_KEY }}
SERVICE_ACCOUNT_TOKEN: ${{ secrets.SERVICE_ACCOUNT_TOKEN }}
name: Deploy app