Skip to content

Commit

Permalink
Update deployment dotnet.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ryzam authored Jun 13, 2024
1 parent 97eb637 commit c14756e
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Simple Console Output
name: CI/CD Pipeline

on: [push]

jobs:
print-message:
build:
runs-on: ubuntu-latest

steps:
Expand All @@ -21,5 +21,34 @@ jobs:
- name: Build project
run: dotnet build src/src.sln --configuration Release

- name: Build Docker image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/webapiargocd:latest -f src/Dockerfile ./publish

- name: Log in to Docker Hub
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin

- name: Push Docker image
run: docker push ${{ secrets.DOCKER_USERNAME }}/webapiargocd:latest

deploy:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout manifests repository
uses: actions/checkout@v4
with:
repository: ryzam/k8s-manifests-repo
ssh-key: ${{ secrets.REPO_SSH_PRIVATE_KEY }}

- name: Update Kubernetes manifests
run: |
sed -i 's|image: .*$|image: ${{ secrets.DOCKER_USERNAME }}/webapiargocd:latest|' k8s/deployment.yaml
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add k8s/deployment.yaml
git commit -m "Update image to ${{ secrets.DOCKER_USERNAME }}/webapiargocd:latest"
git push origin main
- name: Print message
run: echo "Hello, this is a simple GitHub Action!"

0 comments on commit c14756e

Please sign in to comment.