Convert app into pure Elysia #5
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: pr-deploys | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: docker | |
| uses: docker/setup-buildx-action@v3 | |
| - name: login | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| push: true | |
| tags: ghcr.io/rayriffy/apple-music-github-profile-runtime:pr-${{ github.event.pull_request.number }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: comment | |
| uses: actions/github-script@v6 | |
| if: success() | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const imageName = `ghcr.io/rayriffy/apple-music-github-profile-runtime:pr-${context.issue.number}`; | |
| // Find and delete previous docker pull comments | |
| const comments = await github.rest.issues.listComments({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo | |
| }); | |
| // Look for comments containing our specific message format | |
| const dockerPullComments = comments.data.filter(comment => | |
| comment.body.includes('Docker image has been built and pushed successfully') && | |
| comment.body.includes('docker pull') | |
| ); | |
| // Delete those comments | |
| for (const comment of dockerPullComments) { | |
| await github.rest.issues.deleteComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: comment.id | |
| }); | |
| } | |
| // Add the new comment | |
| await github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `✅ Docker image has been built and pushed successfully!\n\nYou can pull this image using:\n\`\`\`bash\ndocker pull ${imageName}\n\`\`\`` | |
| }); |