Skip to content

Commit

Permalink
Tweak the action a bit (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
fundthmcalculus authored Aug 30, 2022
1 parent 1ac0ca5 commit abb1732
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/release-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build Plugin

on:
workflow_call:
workflow_dispatch:
push:
branches:
- main

jobs:
release-golang-plugin:
name: Release binary
runs-on: ubuntu-latest
strategy:
matrix:
goos: [ "linux", "darwin", "windows" ]
goarch: [ "amd64", "arm64" ]
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
cache: true
cache-dependency-path: go.sum
- name: Build Golang
run: |
go version
go mod vendor
go build -o "protoc-gen-sdk-${{ matrix.goos }}-${{ matrix.goarch }}"
working-directory: ./
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
- uses: actions/upload-artifact@v3
with:
name: "go-plugin"
path: ./protoc-gen-sdk-*
9 changes: 6 additions & 3 deletions action.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ param(
[Parameter(Mandatory=$true)][string]$SwiftPath
)

Set-Location $PSScriptRoot

go version
go mod vendor
go build

Set-Location $PSScriptRoot

$PROTO_DIR = Resolve-Path "$PSScriptRoot/$ProtoPath"

$PythonArg = "python_path=${PythonPath}"
Expand All @@ -26,11 +28,12 @@ $JavaKotlinArg = "javakotlin_path=${JavaKotlinPath}"
$RubyArg = "ruby_path=${RubyPath}"
$SwiftArg = "swift_path=${SwiftPath}"

$PluginPath = "${PSScriptRoot}/protoc-gen-sdk$(If ($IsWindows) {'.exe'} Else {''})"

foreach ($Item in Get-ChildItem -Path $PROTO_DIR -Include *.proto -Recurse)
{
$File = $Item.FullName
$Expr = "protoc --plugin=protoc-gen-trinsic-sdk=${PSScriptRoot}/protoc-gen-sdk.exe --trinsic-sdk_out=${RenamePairs},${DartArg},${PythonArg},${GolangArg},${TypescriptArg},${DotnetArg},${JavaKotlinArg},${RubyArg},${SwiftArg}: -I $PROTO_DIR $File"
$Expr = "protoc --plugin=protoc-gen-trinsic-sdk=${PluginPath} --trinsic-sdk_out=${RenamePairs},${DartArg},${PythonArg},${GolangArg},${TypescriptArg},${DotnetArg},${JavaKotlinArg},${RubyArg},${SwiftArg}: -I $PROTO_DIR $File"
Write-Output $Expr
Invoke-Expression $Expr
}
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ inputs:
runs:
using: "composite"
steps:
- uses: dawidd6/action-download-artifact@v2
with:
repo: "trinsic-id/protoc-gen-sdk"
workflow: "release-plugin.yml"
path: ./
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v3
with:
Expand Down
3 changes: 2 additions & 1 deletion build_test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ Set-Location $PSScriptRoot

# Compile in the `SdkTemplateOption` in `field-options.proto`
protoc --proto_path=..\sdk\proto --go_out=.\ ..\sdk\proto\services\options\*.proto

go version
go mod vendor
go build

$RenamePairs = "trust-registry=trustregistry,universal-wallet=wallet,verifiable-credentials=credential,templates=template"
Expand Down

0 comments on commit abb1732

Please sign in to comment.