Skip to content

Commit

Permalink
ci(cli): wgc release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
endigma committed Feb 24, 2025
1 parent 96ec58a commit aff9595
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
66 changes: 66 additions & 0 deletions .github/workflows/cli-binary-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build and release wgc binaries
# on:
# release:
# types: [published]
on:
pull_request:
paths:
- "cli/**/*"
- "connect/**/*"
- ".github/workflows/cli-ci.yaml"

permissions:
contents: write
packages: write

jobs:
wgc-releases-matrix:
# if: startsWith(github.event.release.tag_name, 'wgc@')
name: Build and release wgc binaries
runs-on: ubuntu-latest
timeout-minutes: 30

strategy:
matrix:
target: [bun-linux-x64, bun-linux-arm64, bun-darwin-x64, bun-darwin-arm64]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2

- uses: ./.github/actions/node

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm run --filter ./cli --filter ./connect --filter ./shared --filter ./composition build

- uses: winterjung/split@v2
id: split
with:
separator: "@"
msg: "[email protected]"
# msg: "${{ github.event.release.tag_name }}"

- name: Set BUILD_TIME env
run: echo BUILD_TIME=$(date -u +'%Y-%m-%dT%H:%M:%SZ') >> ${GITHUB_ENV}

- name: "Build wgc binary"
working-directory: cli
run: bun build --compile --target ${{ matrix.target }} src/index.ts --outfile out/wgc-${{ steps.split.outputs._1 }}-${{ matrix.target }}

- name: "Upload builds as artifacts"
uses: actions/upload-artifact@v4
with:
name: wgc-${{ steps.split.outputs._1 }}-${{ matrix.target }}
path: cli/out/wgc-${{ steps.split.outputs._1 }}-${{ matrix.target }}

# - name: "Upload build to release"
# working-directory: cli
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# shell: bash
# run: gh release upload ${{ github.event.release.tag_name }} wgc-${{ matrix.target }} --clobber
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"scripts": {
"build": "del dist && tsc",
"build:bun": "bun build src/index.ts --outfile wgc --compile",
"build:bun": "bun build --compile src/index.ts --outfile wgc",
"wgc": "tsx --env-file .env src/index.ts",
"test": "pnpm lint && vitest run",
"coverage": "vitest run --coverage",
Expand Down

0 comments on commit aff9595

Please sign in to comment.