75 lines
2.3 KiB
YAML
75 lines
2.3 KiB
YAML
name: Generate and Release Protos
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Get Version
|
|
id: get_version
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
|
|
- uses: bufbuild/buf-setup-action@v1
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.23'
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '18.18.x'
|
|
registry-url: 'https://git.fjla.uk/api/packages/owlboard/npm'
|
|
scope: '@owlboard'
|
|
|
|
- name: Install Go Protoc Plugin
|
|
run: |
|
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
|
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
|
|
|
- name: Install TS-Proto Plugin
|
|
run: |
|
|
npm install ts-proto
|
|
echo "$PATH:$(pwd)/ts-proto" >> $GITHUB_PATH
|
|
which protec-gen-ts_proto
|
|
|
|
- name: Generate Code
|
|
run: buf generate
|
|
|
|
- name: Publish TS
|
|
working-directory: gen/ts
|
|
run: |
|
|
npm init -y
|
|
jq '.name = "@owlboard/backend-data-contracts" |
|
|
.version = "${{ steps.get_version.outputs.VERSION }}" |
|
|
.description = "Generated Protobuf types for data ingress services" |
|
|
.repository = {
|
|
"type": "git",
|
|
"url": "git+https://${{ github.server_url }}/${{ github.repository }}.git"
|
|
} |
|
|
.bugs = {
|
|
"url": "https://${{ github.server_url }}/${{ github.repository }}/issues"
|
|
} |
|
|
.homepage = "https://${{ github.server_url }}/${{ github.repository }}#readme"' \
|
|
package.json > temp.json && mv temp.json package.json
|
|
npm publish
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PUSH }}
|
|
|
|
- name: Commit Generated Go
|
|
run: |
|
|
git config user.name "owlbot"
|
|
git config user.email "owlbot@owlboard.info"
|
|
git add gen/go/*.go
|
|
git commit -m "OwlBot: Generated go types for ${{ steps.get_version.outputs.VERSION }}"
|
|
git diff-index --quiet HEAD || git commit -m "OwlBot: Generated go types for ${{ steps.get_version.outputs.VERSION }}"
|
|
git push origin HEAD:refs/tags/${{ github.ref_name }} --force
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.REPO_PUSH }} |