publish #57
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: release | |
on: | |
repository_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
env: | |
RELEASE_TAG: v${{ github.event.client_payload.tag }} | |
if: github.event.action == 'publish' | |
steps: | |
- run: echo $RELEASE_TAG | |
- uses: actions/checkout@v4 | |
with: | |
path: 'go-tapir' | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: 'go-tapir/go.mod' | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'stroeer/tapir' | |
ref: '${{ env.RELEASE_TAG }}' | |
path: 'tapir' | |
- uses: bufbuild/buf-setup-action@v1 | |
- name: generate code | |
run: make generate TEMPLATE=buf.gen.go.yaml | |
working-directory: tapir | |
- name: synchronize module | |
working-directory: tapir | |
run: | | |
rsync -avu --delete gen/go/ ../go-tapir/ \ | |
--exclude=/.git \ | |
--exclude=/.github \ | |
--exclude=README.md \ | |
--exclude=go.mod \ | |
--exclude=go.sum | |
- run: go mod tidy | |
working-directory: go-tapir | |
- name: release module | |
working-directory: go-tapir | |
run: | | |
git config --global user.name 'tapir-bot' | |
git config --global user.email 'tapir-bot@users.noreply.github.com' | |
git status | |
git add -A | |
git commit -vsam "tapir $RELEASE_TAG" || true | |
git tag -a $RELEASE_TAG -m "$RELEASE_TAG" | |
git push origin $RELEASE_TAG | |
git push |