From 8e15c9093b2bcb40f3b9261165da35efdcbdbd6d Mon Sep 17 00:00:00 2001 From: Guoguo Date: Fri, 13 Feb 2026 10:03:04 +0800 Subject: [PATCH] ci: add release workflow --- .github/workflows/release.yml | 99 +++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..59cc6ca --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,99 @@ +name: Create Tag and Release + +on: + workflow_dispatch: + inputs: + tag: + description: "Release tag (required, e.g. v0.2.0)" + required: true + type: string + prerelease: + description: "Mark as pre-release" + required: false + type: boolean + default: false + draft: + description: "Create as draft" + required: false + type: boolean + default: false + +jobs: + create-tag: + name: Create Git Tag + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Create and push tag + shell: bash + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -a "${{ inputs.tag }}" -m "Release ${{ inputs.tag }}" + git push origin "${{ inputs.tag }}" + + build-binaries: + name: Build Release Binaries + needs: create-tag + runs-on: ubuntu-latest + steps: + - name: Checkout tag + uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag }} + + - name: Setup Go from go.mod + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Build all binaries + run: make build-all + + - name: Generate checksums + shell: bash + run: | + shasum -a 256 build/picoclaw-* > build/sha256sums.txt + + - name: Upload release binaries artifact + uses: actions/upload-artifact@v4 + with: + name: picoclaw-binaries + path: | + build/picoclaw-* + build/sha256sums.txt + if-no-files-found: error + + create-release: + name: Create GitHub Release + needs: [create-tag, build-binaries] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: release-artifacts + + - name: Show downloaded files + run: ls -R release-artifacts + + - name: Create release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ inputs.tag }} + name: ${{ inputs.tag }} + draft: ${{ inputs.draft }} + prerelease: ${{ inputs.prerelease }} + files: | + release-artifacts/**/* + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}