CD #7
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: CD | |
on: workflow_dispatch | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ env.DOCKERHUB_USERNAME }} | |
password: ${{ env.DOCKERHUB_PASSWORD }} | |
- name: Build Docker image | |
run: | | |
cd app | |
docker build -t ${{ env.DOCKERHUB_USERNAME }}/app:${{ github.sha }} . | |
- name: Push Docker image | |
run: docker push ${{ env.DOCKERHUB_USERNAME }}/app:${{ github.sha }} | |
- name: Update values.yaml | |
run: | | |
cd helm | |
sed -i 's|APP_VERSION:.*|APP_VERSION: '${{ github.sha }}'|' values.yaml | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email 'actions@github.com' | |
git add values.yaml | |
git commit -m "Update values.yaml" | |
git push | |