feat: Update API executable (v1.0.0) #53
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
| # .github/workflows/build_executables.yml | ||
| name: Build and Release QGenie | ||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
| jobs: | ||
| # ================================== | ||
| # 파이프라인 시작 알림 | ||
| # ================================== | ||
| start: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Send Pipeline Start Notification | ||
| run: | | ||
| curl -X POST -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "username": "APP 배포 봇", | ||
| "embeds": [{ | ||
| "description": "**${{ github.ref_name }}** APP 배포를 시작합니다.", | ||
| "color": 2243312 | ||
| }] | ||
| }' \ | ||
| ${{ secrets.DISCORD_WEBHOOK_URL }} | ||
| # ================================== | ||
| # 실행 파일 빌드 | ||
| # ================================== | ||
| build: | ||
| strategy: | ||
| matrix: | ||
| os: [macos-latest, windows-latest] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Node.js from .nvmrc | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: 'npm' | ||
| - name: Install dependencies | ||
| run: npm cache clean --force && npm install | ||
| - name: Build the app | ||
| run: npm run build -- --${{ matrix.os == 'macos-latest' && 'mac' || 'win' }} | ||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: dist-${{ matrix.os }} | ||
| path: | | ||
| dist/*.dmg | ||
| dist/*.exe | ||
| retention-days: 14 # Artifacts 보존 기간 설정 | ||
| release: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: dist-* | ||
| merge-multiple: true | ||
| path: dist | ||
| - name: Create Release and Upload Assets | ||
| id: create_release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| body: ${{ github.event.release.body }} | ||
| files: | | ||
| dist/*.dmg | ||
| dist/*.exe | ||
| - name: Get DMG Download URL | ||
| id: get_dmg_url | ||
| run: | | ||
| URL=$(echo '${{ steps.create_release.outputs.assets }}' | jq -r '.[] | select(.name | endswith(".dmg")) | .browser_download_url') | ||
| echo "dmg_url=${URL}" >> $GITHUB_OUTPUT | ||
| - name: Dispatch Homebrew Tap Update | ||
| uses: peter-evans/repository-dispatch@v3 | ||
| with: | ||
| token: ${{ secrets.RELEASE_TOKEN }} | ||
| repository: Queryus/homebrew-qgenie | ||
| event-type: new-release-update-brew | ||
| client-payload: >- | ||
| { | ||
| "version": "${{ github.ref_name }}", | ||
| "download_url": "${{ steps.get_dmg_url.outputs.dmg_url }}" | ||
| } | ||
| # ================================== | ||
| # 파이프라인 최종 결과 알림 | ||
| # ================================== | ||
| finish: | ||
| needs: deploy | ||
| runs-on: ubuntu-latest | ||
| if: always() | ||
| steps: | ||
| - name: Send Success Notification | ||
| if: needs.deploy.result == 'success' | ||
| run: | | ||
| curl -X POST -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "username": "APP 배포 봇", | ||
| "embeds": [{ | ||
| "title": "New APP Release: ${{ github.ref_name }}", | ||
| "url": "${{ github.event.release.html_url }}", | ||
| "description": "**${{ github.ref_name }}** APP 배포가 성공적으로 완료되었습니다!", | ||
| "color": 5167473 | ||
| }] | ||
| }' \ | ||
| ${{ secrets.DISCORD_WEBHOOK_URL }} | ||
| - name: Send Failure Notification | ||
| if: contains(needs.*.result, 'failure') | ||
| run: | | ||
| curl -X POST -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "username": "APP 배포 봇", | ||
| "embeds": [{ | ||
| "title": "APP 배포 실패", | ||
| "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | ||
| "description": "**${{ github.ref_name }}** APP 배포 중 오류가 발생했습니다.", | ||
| "color": 15219495 | ||
| }] | ||
| }' \ | ||
| ${{ secrets.DISCORD_WEBHOOK_URL }} | ||
| - name: Send Skipped or Cancelled Notification | ||
| if: contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') | ||
| run: | | ||
| curl -X POST -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "username": "APP 배포 봇", | ||
| "embeds": [{ | ||
| "title": "APP 배포 미완료", | ||
| "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | ||
| "description": "**${{ github.ref_name }}** APP 배포가 완료되지 않았습니다. (상태: 취소 또는 건너뜀)\n이전 단계에서 문제가 발생했을 수 있습니다.", | ||
| "color": 16577629 | ||
| }] | ||
| }' \ | ||
| ${{ secrets.DISCORD_WEBHOOK_URL }} | ||