trigger pipeline #1
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: ci | |
env: | |
CONFIG_REPO_NAME: argocd-course-webapp-config | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
build-test: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "building and testing the app ..." | |
docker-build-push: | |
runs-on: ubuntu-latest | |
needs: build-test | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v2 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: WebApplication1/Dockerfile | |
push: true | |
tags: letsbootch/argocd-course-webapp:${{ github.sha }} | |
promote-to-dev-environment: | |
runs-on: ubuntu-latest | |
needs: docker-build-push | |
steps: | |
- run: | | |
echo "promoting into dev environment!" | |
git config --global user.email [email protected] && git config --global user.name ci-bot | |
echo "cloning config repo $CONFIG_REPO_NAME" | |
git clone https://oauth2:${{ secrets.GH_PAT }}@github.com/${{ github.repository_owner }}/$CONFIG_REPO_NAME.git | |
cd $CONFIG_REPO_NAME | |
echo "checkout main branch" | |
git checkout main | |
echo "updating image tag in values file" | |
sed -i "s,tag:.*,tag:\ ${{ github.sha }}," helm/webapp/values.yaml | |
git add . && git commit -m "update image tag" | |
git push | |