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-action@v1.3 with: setup_only: true version: '1.63.0' - 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 typescript echo "$PATH:$(pwd)/ts-proto" >> $GITHUB_PATH - name: Generate Code run: buf generate - 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 }}" | .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 --module esnext --target es2022 --moduleResolution node --outDir dist/ npm publish env: NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PUSH }} - name: Publish Go run: | 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