fix: webhook url #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: Java CI with Gradle | |
on: | |
push: | |
branches: [ "main", "dev" ] | |
env: | |
ECR_URL: ${{ secrets.ECR_REPO_DEV }} | |
ROLE_ARN: ${{ secrets.OIDC_ROLE }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
WEBHOOK_URL: ${{ secrets.WEBHOOK }} | |
DEPLOY_ENV: ${{ github.ref == 'refs/heads/main' && 'PROD' || 'DEV' }} | |
permissions: | |
id-token: write | |
contents: write | |
jobs: | |
build: | |
name: Build | |
runs-on: self-hosted | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew bootJar | |
- name: Docker build | |
run: docker build -t batch-service . | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-region: ${{ env.AWS_REGION }} | |
role-session-name: GitHubActions | |
role-to-assume: ${{ env.ROLE_ARN }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Publish Image to ECR(BATCH-SERVICE) | |
run: | | |
docker tag batch-service:latest ${{ env.ECR_URL }}:${{ github.sha }} | |
docker push ${{ env.ECR_URL }}:${{ github.sha }} | |
- name: notification to swit | |
uses: roharon/action-swit@v1 | |
with: | |
webhooks_url: ${{ env.WEBHOOK_URL }} | |
MESSAGE: "🏷 ${{ job.status }} 백엔드 ECR 도커파일 업로드 : Batch-service - by ${{ github.actor }}" | |
- name: Setup Kustomize | |
uses: imranismail/setup-kustomize@v1 | |
- name: Checkout for Kustomize repository | |
uses: actions/checkout@v2 | |
with: | |
repository: Project-Catcher/batch-service-kusto | |
ref: main | |
token: ${{ env.GITHUB_TOKEN }} | |
path: batch-service-kusto | |
- name: Update Kustomize image | |
run: | | |
KUSTOMIZE_PATH="batch-service-kusto/dev" | |
cd $KUSTOMIZE_PATH | |
kustomize edit set image batch-svc-image="${{ env.ECR_URL }}:${{ github.sha }}" | |
kustomize build . | |
- name: Commit minifest files | |
run: | | |
cd batch-service-kusto | |
git config --global user.email "[email protected]" | |
git config --global user.name "github-actions" | |
git commit -am "update : image tag" | |
git push -u origin main | |
- name: Sync ArgoCD Application | |
run: | | |
argocd app sync dev-app-core \ | |
--server argocd.dev-alltimecatcher.com \ | |
--auth-token ${{ secrets.ARGOCD_TOKEN }} --insecure |