More lunar crystallize fixes #9
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: build server | |
| on: | |
| pull_request_target: | |
| branches: | |
| - main | |
| # Permissions required to upload releases and write comments | |
| permissions: | |
| pull-requests: write | |
| jobs: | |
| build-and-comment: | |
| name: build binary | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| # Example: Setting up Go (Change this to your specific language setup) | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "^1.21" | |
| - name: Build Binary | |
| run: | | |
| GOOS=windows GOARCH=amd64 go build -ldflags "-X main.version=`git tag --sort=-version:refname | head -n 1`" -o server-pr${{ github.event.pull_request.number }}.exe ./cmd/server | |
| # 1. Upload file safely as an artifact without creating tags | |
| - name: Upload Binary Artifact | |
| id: upload-step | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: server-pr${{ github.event.pull_request.number }}.exe | |
| path: server-pr${{ github.event.pull_request.number }}.exe | |
| archive: false | |
| retention-days: 7 | |
| # 2. Post or Update a comment containing the download instructions | |
| - name: Comment PR Link | |
| uses: thollander/actions-comment-pull-request@v3 | |
| with: | |
| comment-tag: pr_binary_download | |
| message: | | |
| **PR Test Server Built Successfully!** | |
| You can download the server directly from the GitHub artifact portal: | |
| Download [server-pr${{ github.event.pull_request.number }}.exe](${{ steps.upload-step.outputs.artifact-url }}) | |
| Note: Download will expire 7 days after the last update | |
| _Note: You must be logged into GitHub to access this link._ |