diff --git a/.github/workflows/release-assets.yml b/.github/workflows/release-assets.yml new file mode 100644 index 0000000..f6b8ab2 --- /dev/null +++ b/.github/workflows/release-assets.yml @@ -0,0 +1,37 @@ +name: Release assets + +on: + release: + types: [published] + workflow_dispatch: + inputs: + tag: + description: 要上传附件的 Release tag + required: true + type: string + +concurrency: + group: release-assets-${{ github.event.release.tag_name || inputs.tag }} + +permissions: + contents: read + +jobs: + idl: + runs-on: ubuntu-latest + permissions: + contents: write + env: + TAG: ${{ github.event.release.tag_name || inputs.tag }} + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ github.token }} + steps: + - uses: actions/checkout@v7 + with: + ref: refs/tags/${{ env.TAG }} + - uses: actions/setup-go@v7 + with: + go-version-file: go.mod + - run: go run ./cmd/protocolgen -check + - run: gh release upload "$TAG" protocol/idl.json --clobber + - run: gh release download "$TAG" --pattern idl.json --output - | cmp - protocol/idl.json