CHANGES 更新 #51
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ^1.20 | |
- name: Build for Windows amd64 | |
run: | | |
DIR=protoc-gen-jsonif/windows/amd64 | |
mkdir -p $DIR | |
go build -o $DIR/protoc-gen-jsonif-c.exe cmd/protoc-gen-jsonif-c/main.go | |
go build -o $DIR/protoc-gen-jsonif-cpp.exe cmd/protoc-gen-jsonif-cpp/main.go | |
go build -o $DIR/protoc-gen-jsonif-unity.exe cmd/protoc-gen-jsonif-unity/main.go | |
go build -o $DIR/protoc-gen-jsonif-typescript.exe cmd/protoc-gen-jsonif-typescript/main.go | |
env: | |
GOOS: windows | |
GOARCH: amd64 | |
- name: Build for Darwin amd64 | |
run: | | |
DIR=protoc-gen-jsonif/darwin/amd64 | |
mkdir -p $DIR | |
go build -o $DIR/protoc-gen-jsonif-c cmd/protoc-gen-jsonif-c/main.go | |
go build -o $DIR/protoc-gen-jsonif-cpp cmd/protoc-gen-jsonif-cpp/main.go | |
go build -o $DIR/protoc-gen-jsonif-unity cmd/protoc-gen-jsonif-unity/main.go | |
go build -o $DIR/protoc-gen-jsonif-typescript cmd/protoc-gen-jsonif-typescript/main.go | |
env: | |
GOOS: darwin | |
GOARCH: amd64 | |
- name: Build for Darwin arm64 | |
run: | | |
DIR=protoc-gen-jsonif/darwin/arm64 | |
mkdir -p $DIR | |
go build -o $DIR/protoc-gen-jsonif-c cmd/protoc-gen-jsonif-c/main.go | |
go build -o $DIR/protoc-gen-jsonif-cpp cmd/protoc-gen-jsonif-cpp/main.go | |
go build -o $DIR/protoc-gen-jsonif-unity cmd/protoc-gen-jsonif-unity/main.go | |
go build -o $DIR/protoc-gen-jsonif-typescript cmd/protoc-gen-jsonif-typescript/main.go | |
env: | |
GOOS: darwin | |
GOARCH: arm64 | |
- name: Build for Linux amd64 | |
run: | | |
DIR=protoc-gen-jsonif/linux/amd64 | |
mkdir -p $DIR | |
go build -o $DIR/protoc-gen-jsonif-c cmd/protoc-gen-jsonif-c/main.go | |
go build -o $DIR/protoc-gen-jsonif-cpp cmd/protoc-gen-jsonif-cpp/main.go | |
go build -o $DIR/protoc-gen-jsonif-unity cmd/protoc-gen-jsonif-unity/main.go | |
go build -o $DIR/protoc-gen-jsonif-typescript cmd/protoc-gen-jsonif-typescript/main.go | |
env: | |
GOOS: linux | |
GOARCH: amd64 | |
- name: Copy .proto file | |
run: cp -r proto/ protoc-gen-jsonif/proto/ | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: protoc-gen-jsonif | |
path: protoc-gen-jsonif | |
create-release: | |
name: Create Release | |
if: contains(github.ref, 'tags/') | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- uses: actions/download-artifact@v2 | |
with: | |
name: protoc-gen-jsonif | |
path: protoc-gen-jsonif | |
- run: tar czf protoc-gen-jsonif.tar.gz protoc-gen-jsonif | |
- name: Upload protoc-gen-jsonif Release Asset | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: protoc-gen-jsonif.tar.gz | |
asset_name: protoc-gen-jsonif.tar.gz | |
asset_content_type: application/gzip | |
- run: zip -r protoc-gen-jsonif.zip protoc-gen-jsonif | |
- name: Upload protoc-gen-jsonif Release Asset | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: protoc-gen-jsonif.zip | |
asset_name: protoc-gen-jsonif.zip | |
asset_content_type: application/zip |