Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: introduce go release step #62

Merged
merged 22 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/actions/go-release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: 'release go code'
description: 'Pushes go code to the sdk repo'
inputs:
repository-token:
description: token for git authentication
required: true
mode:
description: supporte values are 'release' and 'dry-run'
required: true

runs:
using: 'composite'
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.20

- name: Attempt Build
working-directory: codegen/go
shell: bash
env:
TOKEN: ${{ inputs.repository-token }}
run: |
go get -v -t -d ./...
go build -v ./...

- uses: actions/checkout@v4
with:
repository: utxorpc/go-sdk
fetch-depth: 0
token: ${{ inputs.repository-token }}
path: go-sdk

- name: Copy new spec
shell: bash
run: |
rm -Rf go-sdk/spec
mv codegen/go go-sdk/spec

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
if: inputs.mode == 'release'
with:
commit-message: "chore: update spec codegen"
git-token: ${{ inputs.repository-token }}
token: ${{ inputs.repository-token }}
branch-suffix: short-commit-hash
branch: spec-codegen
title: "chore: update spec codegen"
body: "A new codegen version of the specs is available. Please review and merge to keep the SDK up-to-date."
path: go-sdk
base: main
17 changes: 17 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,20 @@ jobs:
with:
registry-token: ${{ secrets.NPM_REGISTRY_TOKEN }}
mode: ${{ inputs.mode }}

go-release:
runs-on: ubuntu-latest

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

- uses: actions/download-artifact@v4
with:
name: codegen
path: ./codegen

- uses: ./.github/actions/go-release
with:
repository-token: ${{ secrets.GOSDK_REPOSITORY_TOKEN }}
mode: ${{ inputs.mode }}
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
publish-dry-run:
needs: [generate]
uses: ./.github/workflows/publish.yml
secrets: inherit
with:
mode: "dry-run"

Expand Down
8 changes: 5 additions & 3 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@ version: v1
managed:
enabled: true
go_package_prefix:
default: github.com/utxorpc/spec/gen/go
default: github.com/utxorpc/go-sdk/spec

plugins:

# go

- plugin: buf.build/protocolbuffers/go
out: gen/go
opt: paths=source_relative
opt:
- paths=source_relative

- plugin: buf.build/connectrpc/go
out: gen/go
opt: paths=source_relative
opt:
- paths=source_relative

# rust

Expand Down
2 changes: 1 addition & 1 deletion gen/go/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/utxorpc/spec
module github.com/utxorpc/go-sdk/spec

go 1.20

Expand Down
Loading