Ugrade generation steps to use bufv2, and Gitea Go package registry.

This commit is contained in:
2026-01-07 13:15:14 +00:00
parent 59e405d2c4
commit 7e2361015a
10 changed files with 64 additions and 63 deletions

View File

@@ -17,7 +17,7 @@ jobs:
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- uses: bufbuild/buf-setup-action@v1
- uses: bufbuild/buf-setup-action@v1.5.0
- uses: actions/setup-go@v5
with:
@@ -36,39 +36,36 @@ jobs:
- name: Install TS-Proto Plugin
run: |
npm install ts-proto
npm install ts-proto typescript
echo "$PATH:$(pwd)/ts-proto" >> $GITHUB_PATH
- name: Generate Code
run: buf generate
- name: Publish TS
- name: Build and Publish TS
working-directory: gen/ts
run: |
npm init -y
# Add a build script to the generated package.json
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"' \
.main = "./dist/index.js" |
.types = "./dist/index.d.ts" |
.scripts.build = "tsc *.ts --declaration --esm --outDir dist/" |
.devDependencies.typescript = "^5.0.0"' \
package.json > temp.json && mv temp.json package.json
npx tsc *.ts --declaration --esm --outDir dist/ --target es2022 --moduleResolution node
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PUSH }}
- name: Commit Generated Go
- name: Publish 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 }}
cd gen/go
go mod init git.fjla.uk/owlboard/backend-data-contracts
go mod tidy
zip -r ../../rail-backend-${{ steps.get_version.outputs.VERSION }}.zip .
curl --user "owlbot:${{ secrets.PACKAGE_PUSH }}" \
--upload-file ../../rail-backend-${{ steps.get_version.outputs.VERSION }}.zip \
https://${{ github.server_url }}/api/packages/owlboard/go/upload