name: 🚀 Release on: push: tags: - "v*" workflow_dispatch: permissions: contents: write jobs: build-and-publish: name: 🚀 Build & Publish Multi-Platform Binaries runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Bun uses: oven-sh/setup-bun@v2 with: bun-version: latest - name: Install dependencies run: bun install --frozen-lockfile - name: Type-check run: bun run check - name: Compile multi-target binaries run: | mkdir -p dist/bin node scripts/build-binary.mjs --all - name: Package release archives run: | sudo apt-get update && sudo apt-get install -y zip cd dist/bin tar -czf hose-use-linux-x64.tar.gz hose-use-linux-x64 tar -czf hose-use-linux-arm64.tar.gz hose-use-linux-arm64 tar -czf hose-use-darwin-x64.tar.gz hose-use-darwin-x64 tar -czf hose-use-darwin-arm64.tar.gz hose-use-darwin-arm64 zip -q hose-use-windows-x64.zip hose-use-windows-x64.exe - name: Publish GitHub Release env: GH_TOKEN: ${{ github.token }} run: | TAG_MSG=$(git tag -l --format='%(contents)' "${GITHUB_REF_NAME}" | sed '/^$/d') if [ -n "$TAG_MSG" ]; then gh release view "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1 || gh release create "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" --title "${GITHUB_REF_NAME}" --notes "$TAG_MSG" --generate-notes else gh release view "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1 || gh release create "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" --title "${GITHUB_REF_NAME}" --generate-notes fi gh release upload "${GITHUB_REF_NAME}" dist/bin/hose-use-* --repo "${GITHUB_REPOSITORY}" --clobber