Merge pull request #9 from roro89/features/cicd #21
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: .NET | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore ./api/api.csproj | |
- name: Build | |
run: dotnet build --no-restore ./api/api.csproj -c Release | |
- name: Publish | |
run: dotnet publish --no-build ./api/api.csproj -c Release -o ./api/out | |
# Publishing to Docker HUB | |
#- name: Build and Push Docker Image | |
# uses: mr-smithers-excellent/docker-build-push@v4 | |
# with: | |
# image: wombir/finshark-api | |
# registry: docker.io | |
# dockerfile: ./api/Dockerfile | |
# username: ${{ secrets.DOCKER_USERNAME }} | |
# password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and Push Docker Image to GCP | |
uses: mr-smithers-excellent/docker-build-push@v6 | |
with: | |
image: finshark/finsharp-api | |
registry: gcr.io | |
dockerfile: ./api/Dockerfile | |
username: _json_key | |
password: ${{ secrets.GCP_SA_KEY }} |