fix(build-push.yml): push 에러 수정 #3
Workflow file for this run
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: Build and Deploy to Docker Hub | |
on: | |
push: | |
branches: [ "deploy" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Build with Gradle | |
run: ./gradlew build --daemon --parallel | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Build and Push Docker Image | |
run: | | |
docker buildx create --use | |
docker buildx build --platform linux/arm64,linux/amd64 -t yeseulhong/grass-diary:${{ github.sha }} --push . | |
- name: Update Kubernetes Manifests # refs/heads/deploy -> refs/heads/release 추후 변경 | |
run: | | |
if [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then | |
sed -i 's/\${IMAGE_TAG}/'"${{ github.sha }}"'/g' k8s/dev/deployment.yaml | |
elif [[ "${{ github.ref }}" == "refs/heads/deploy" ]]; then | |
sed -i 's/\${IMAGE_TAG}/'"${{ github.sha }}"'/g' k8s/release/deployment.yaml | |
fi | |
- name: Commit and Push Updated Manifests | |
env: | |
GH_PAT: ${{ secrets.DEPLOY_BOT_TOKEN }} | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "jjaegii" | |
git add . | |
git commit -m "Update deployment with image tag ${{ github.sha }} for ${{ github.ref }}" | |
git push https://[email protected]/CHZZK-Study/Grass-Diary-Server.git ${{ github.ref }} |