Update close-jira-issue.yml #73
This file contains hidden or 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: Dev CI/CD - Build, Push and Deploy | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| env: | |
| REGISTRY: docker.io | |
| IMAGE_NAME: ninecraft0523/ninecraft-server | |
| MODULE: apis | |
| jobs: | |
| build-push-and-deploy: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| environment: development | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Inject application-secret.properties from Secrets | |
| run: | | |
| mkdir ./secret | |
| echo "${{ secrets.DEV_SECRET_PROPERTIES }}" > ./secret/application-dev-secret.properties | |
| echo "${{ secrets.APPLE_AUTH_KEY }}" > ./secret/AuthKey.p8 | |
| chmod 600 ./secret/* | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Extract metadata for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=development-latest | |
| - name: Build and push Docker image | |
| id: build-and-push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: linux/amd64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| MODULE=${{ env.MODULE }} | |
| - name: Deploy to Development Server | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.DEV_HOST }} | |
| username: ${{ secrets.DEV_USERNAME }} | |
| key: ${{ secrets.DEV_SSH_KEY }} | |
| port: ${{ secrets.DEV_PORT }} | |
| script: | | |
| export DOCKERHUB_USERNAME="${{ secrets.DOCKERHUB_USERNAME }}" | |
| export DOCKERHUB_TOKEN="${{ secrets.DOCKERHUB_TOKEN }}" | |
| export IMAGE_TAG="$(echo "${{ steps.meta.outputs.tags }}" | head -n1)" | |
| cd ~/deploy | |
| chmod +x ./deploy.sh | |
| ./deploy.sh | |
| - name: Send Discord notification on success | |
| uses: tsickert/discord-webhook@b217a69502f52803de774ded2b1ab7c282e99645 | |
| if: success() | |
| continue-on-error: true | |
| with: | |
| webhook-url: ${{ secrets.DEV_DEPLOY_DISCORD_WEBHOOK_URL }} | |
| embed-title: "✅ [${{ github.repository }}] Development Deploy Succeeded" | |
| embed-description: | | |
| **Commit**: `${{ github.sha }}` | |
| **Author**: `${{ github.actor }}` | |
| **Message**: `${{ github.event.head_commit.message }}` | |
| [View Committed Changes](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) | |
| embed-color: 65280 | |
| - name: Send Discord notification on failure | |
| uses: tsickert/discord-webhook@b217a69502f52803de774ded2b1ab7c282e99645 | |
| if: failure() | |
| continue-on-error: true | |
| with: | |
| webhook-url: ${{ secrets.DEV_DEPLOY_DISCORD_WEBHOOK_URL }} | |
| embed-title: "❌ [${{ github.repository }}] Development Deploy Failed" | |
| embed-description: | | |
| **Commit**: `${{ github.sha }}` | |
| **Author**: `${{ github.actor }}` | |
| An error occurred during the workflow execution. | |
| [View Failed Workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
| embed-color: 16711680 |