Publish Release #8
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: Publish Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version tag (e.g. v0.8.0)" | |
| required: true | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download binaries from resend-cli | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| VERSION: ${{ inputs.version }} | |
| run: | | |
| gh release download "${VERSION}" \ | |
| --repo resend/resend-cli \ | |
| --pattern "resend-darwin-arm64.tar.gz" \ | |
| --pattern "resend-darwin-x64.tar.gz" \ | |
| --pattern "resend-linux-arm64.tar.gz" \ | |
| --pattern "resend-linux-x64.tar.gz" \ | |
| --dir ./artifacts | |
| - name: Compute SHA256 and update formula | |
| env: | |
| VERSION: ${{ inputs.version }} | |
| run: | | |
| VER="${VERSION#v}" | |
| SHA_DARWIN_ARM64=$(sha256sum artifacts/resend-darwin-arm64.tar.gz | awk '{print $1}') | |
| SHA_DARWIN_X64=$(sha256sum artifacts/resend-darwin-x64.tar.gz | awk '{print $1}') | |
| SHA_LINUX_ARM64=$(sha256sum artifacts/resend-linux-arm64.tar.gz | awk '{print $1}') | |
| SHA_LINUX_X64=$(sha256sum artifacts/resend-linux-x64.tar.gz | awk '{print $1}') | |
| sed \ | |
| -e "s/{{VER}}/${VER}/g" \ | |
| -e "s/{{SHA_DARWIN_ARM64}}/${SHA_DARWIN_ARM64}/" \ | |
| -e "s/{{SHA_DARWIN_X64}}/${SHA_DARWIN_X64}/" \ | |
| -e "s/{{SHA_LINUX_ARM64}}/${SHA_LINUX_ARM64}/" \ | |
| -e "s/{{SHA_LINUX_X64}}/${SHA_LINUX_X64}/" \ | |
| Formula/resend.rb.tpl > Formula/resend.rb | |
| rm -rf ./artifacts | |
| - name: Create PR with updated formula | |
| env: | |
| VERSION: ${{ inputs.version }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Formula/resend.rb | |
| git diff --cached --quiet && echo "Formula already up to date" && exit 0 | |
| BRANCH="release/${VERSION}" | |
| git checkout -b "$BRANCH" | |
| git commit -m "resend ${VERSION}" | |
| git push origin "$BRANCH" | |
| gh pr create \ | |
| --title "resend ${VERSION}" \ | |
| --body "Update Homebrew formula for resend ${VERSION}" \ | |
| --base main \ | |
| --head "$BRANCH" |