Files
contracts/.github/workflows/publish.yml
Дмитрий 8d14f7dd55
Some checks failed
Publish / Publish Job (push) Failing after 2m27s
fix: publish git hub action
2026-04-11 10:57:19 +03:00

71 lines
2.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Publish
on:
push:
branches:
- main
jobs:
publish:
name: Publish Job
runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://git.lendry.ru/api/packages/lendry-erp/npm/"
scope: "@lendry-erp"
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Install Go Protoc Plugins
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
# Используем Action для точного контроля версии protoc (например, 25.x)
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
version: "25.x"
- name: Install deps
run: npm ci
# 1. СНАЧАЛА генерируем код (до сборки)
- name: Generate Protobuf
run: |
npm install -g ts-proto
mkdir -p ./gen/go
protoc -I ./proto \
--ts_proto_out=nestJs=true,addGrpcMetadata=true,package=omit:./gen \
--go_out=paths=source_relative:./gen/go \
--go-grpc_out=paths=source_relative:./gen/go \
$(find ./proto -name "*.proto")
# 2. ПОТОМ собираем проект (tsc скомпилирует только что сгенерированные файлы)
- name: Build
run: npm run build
# 3. Коммитим изменения в репозиторий
- name: Commit and push changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add ./gen
git diff --quiet && git diff --staged --quiet || (git commit -m "chore: auto-generate protobuf files [skip ci]" && git push)
# 4. Публикуем пакет (npm возьмет папку dist/ с уже скомпилированными контрактами)
- name: Publish package
run: npm publish