diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bd5ecec..fb4dd58 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -83,7 +83,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: "22" + node-version: "22.14.0" cache: "npm" registry-url: "https://registry.npmjs.org" @@ -190,7 +190,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: "22" + node-version: "22.14.0" registry-url: "https://registry.npmjs.org" - name: Download build artifacts @@ -231,7 +231,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: "22" + node-version: "22.14.0" registry-url: "https://registry.npmjs.org" - name: Download build artifacts diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml deleted file mode 100644 index 0bf0fc7..0000000 --- a/.github/workflows/release-binaries.yml +++ /dev/null @@ -1,194 +0,0 @@ -name: Release Binaries - -on: - push: - tags: - - "v*" - -permissions: - contents: write - packages: write - -concurrency: - group: release-binaries-${{ github.ref }} - cancel-in-progress: false - -env: - GO_VERSION: "1.22" - REGISTRY_IMAGE: ghcr.io/agentworkforce/relayfile - -jobs: - build: - name: Build ${{ matrix.os }}-${{ matrix.arch }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - os: [linux, darwin] - arch: [amd64, arm64] - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Go 1.22 - uses: actions/setup-go@v5 - with: - go-version: ${{ env.GO_VERSION }} - cache: true - - - name: Cross-compile release binaries - env: - CGO_ENABLED: "0" - GOOS: ${{ matrix.os }} - GOARCH: ${{ matrix.arch }} - run: | - mkdir -p dist - - go build -o "dist/relayfile-${GOOS}-${GOARCH}" ./cmd/relayfile - go build -o "dist/relayfile-mount-${GOOS}-${GOARCH}" ./cmd/relayfile-mount - go build -o "dist/relayfile-cli-${GOOS}-${GOARCH}" ./cmd/relayfile-cli - - - name: Create tarballs for Homebrew/install.sh - working-directory: dist - run: | - for bin in relayfile relayfile-mount relayfile-cli; do - cp "${bin}-${{ matrix.os }}-${{ matrix.arch }}" "${bin}" - tar -czf "${bin}_${{ matrix.os }}_${{ matrix.arch }}.tar.gz" "${bin}" - rm "${bin}" - done - - - name: Generate SHA256 checksums - working-directory: dist - run: | - sha256sum \ - "relayfile_${{ matrix.os }}_${{ matrix.arch }}.tar.gz" \ - "relayfile-mount_${{ matrix.os }}_${{ matrix.arch }}.tar.gz" \ - "relayfile-cli_${{ matrix.os }}_${{ matrix.arch }}.tar.gz" \ - "relayfile-${{ matrix.os }}-${{ matrix.arch }}" \ - "relayfile-mount-${{ matrix.os }}-${{ matrix.arch }}" \ - "relayfile-cli-${{ matrix.os }}-${{ matrix.arch }}" \ - > "checksums-${{ matrix.os }}-${{ matrix.arch }}.txt" - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: release-${{ matrix.os }}-${{ matrix.arch }} - path: | - dist/relayfile_${{ matrix.os }}_${{ matrix.arch }}.tar.gz - dist/relayfile-mount_${{ matrix.os }}_${{ matrix.arch }}.tar.gz - dist/relayfile-cli_${{ matrix.os }}_${{ matrix.arch }}.tar.gz - dist/relayfile-${{ matrix.os }}-${{ matrix.arch }} - dist/relayfile-mount-${{ matrix.os }}-${{ matrix.arch }} - dist/relayfile-cli-${{ matrix.os }}-${{ matrix.arch }} - dist/checksums-${{ matrix.os }}-${{ matrix.arch }}.txt - - release: - name: Publish GitHub Release - runs-on: ubuntu-latest - needs: build - - steps: - - name: Download release artifacts - uses: actions/download-artifact@v4 - with: - path: release-assets - merge-multiple: true - - - name: Merge per-platform checksums into checksums.txt - run: | - cat release-assets/checksums-*.txt > release-assets/checksums.txt - rm release-assets/checksums-*.txt - - - name: Show release assets - run: ls -lah release-assets - - - name: Upload to GitHub Release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ github.ref_name }} - files: release-assets/* - generate_release_notes: true - - update-homebrew: - name: Update Homebrew Formula - runs-on: ubuntu-latest - needs: release - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: main - - - name: Download release artifacts - uses: actions/download-artifact@v4 - with: - path: release-assets - merge-multiple: true - - - name: Update Formula/relayfile.rb - run: | - VERSION="${GITHUB_REF_NAME#v}" - DARWIN_ARM64_SHA=$(sha256sum release-assets/relayfile-cli_darwin_arm64.tar.gz | awk '{print $1}') - DARWIN_AMD64_SHA=$(sha256sum release-assets/relayfile-cli_darwin_amd64.tar.gz | awk '{print $1}') - LINUX_ARM64_SHA=$(sha256sum release-assets/relayfile-cli_linux_arm64.tar.gz | awk '{print $1}') - LINUX_AMD64_SHA=$(sha256sum release-assets/relayfile-cli_linux_amd64.tar.gz | awk '{print $1}') - - sed -i 's/version ".*"/version "'"${VERSION}"'"/' Formula/relayfile.rb - - export DARWIN_ARM64_SHA DARWIN_AMD64_SHA LINUX_ARM64_SHA LINUX_AMD64_SHA - python3 << 'PYEOF' - import re, os - sha_map = { - "darwin_arm64": os.environ["DARWIN_ARM64_SHA"], - "darwin_amd64": os.environ["DARWIN_AMD64_SHA"], - "linux_arm64": os.environ["LINUX_ARM64_SHA"], - "linux_amd64": os.environ["LINUX_AMD64_SHA"], - } - with open("Formula/relayfile.rb") as f: - content = f.read() - for key, sha in sha_map.items(): - pattern = r'(url ".*' + key + r'.*"\n\s+sha256 )"[^"]*"' - content = re.sub(pattern, r'\1"' + sha + '"', content) - with open("Formula/relayfile.rb", "w") as f: - f.write(content) - PYEOF - - - name: Commit and push formula update - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git add Formula/relayfile.rb - git commit -m "chore: update Homebrew formula for ${GITHUB_REF_NAME}" - git push - - docker: - name: Build and Push Docker Image - runs-on: ubuntu-latest - needs: release - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push Docker image - uses: docker/build-push-action@v6 - with: - context: . - file: ./Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ${{ env.REGISTRY_IMAGE }}:latest - ${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e1e2057..f522e74 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,9 +41,7 @@ jobs: with: tag_name: ${{ github.ref_name }} generate_release_notes: true - files: | - dist/*.tar.gz - dist/checksums.txt + files: dist/* npm-publish: name: Publish SDK to npm diff --git a/Makefile b/Makefile index e6a8434..1bd12e2 100644 --- a/Makefile +++ b/Makefile @@ -59,10 +59,12 @@ release: clean build-all for bin in $(RELEASE_BINS); do \ archive="$(DIST_DIR)/$${bin}_$${goos}_$${goarch}.tar.gz"; \ LC_ALL=C tar -C "$${work_dir}" -czf "$${archive}" "$${bin}"; \ + cp "$${work_dir}/$${bin}" "$(DIST_DIR)/$${bin}-$${goos}-$${goarch}"; \ done; \ done + rm -rf $(DIST_DIR)/darwin_* $(DIST_DIR)/linux_* cd $(DIST_DIR) && \ - (if command -v sha256sum >/dev/null 2>&1; then sha256sum *.tar.gz > checksums.txt; else shasum -a 256 *.tar.gz > checksums.txt; fi) + (if command -v sha256sum >/dev/null 2>&1; then sha256sum $$(ls -1 | grep -v checksums.txt) > checksums.txt; else shasum -a 256 $$(ls -1 | grep -v checksums.txt) > checksums.txt; fi) clean: rm -rf $(BIN_DIR) $(DIST_DIR)