-
Notifications
You must be signed in to change notification settings - Fork 82
60 lines (49 loc) · 2.23 KB
/
publish-protos-python.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# This defines a workflow to build and release a new version of the
# aptos-indexer-protos package to pypi. In order to trigger it go to the Actions tab of
# the repo, click "Publish aptos-indexer-protos for Python" and then "Run Workflow".
name: "Publish aptos-indexer-protos for Python"
on:
workflow_dispatch:
inputs:
source_git_ref_override:
type: string
required: false
description: "Use this to override the git SHA1, branch name or tag to build the binaries from. Defaults to the workflow git rev, but can be different than that:"
jobs:
publish-crate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.source_git_ref_override }}
- uses: ./.github/actions/python-setup
with:
pyproject_directory: python/aptos-indexer-protos
# Get the version of the package on pypi
- name: Get current version
id: get_current_version
run: |
echo "::set-output name=current_version::$(curl -s https://pypi.org/pypi/aptos-indexer-protos/json | jq -r .info.version)"
# Get the version of the package in the repo
- name: Get repo version
id: get_repo_version
run: |
echo "::set-output name=repo_version::$(grep -oP '(?<=version = ").*(?=")' python/aptos-indexer-protos/pyproject.toml)"
# Exit if the version in the repo matches the one on pypi
- name: Exit if versions match
if: ${{ steps.get_current_version.outputs.current_version == steps.get_repo_version.outputs.repo_version }}
run: echo "Version of package in repo matches version on pypi, exiting..." && exit 1
- name: Generate code from the protos to check they match
run: poetry run poe generate
with:
working-directory: python/aptos-indexer-protos
# Ensure the generated code matches the protos.
- name: Check generated code matches protos
run: git diff --ignore-space-at-eol --ignore-blank-lines
with:
working-directory: python/aptos-indexer-protos
# Publish the package.
- name: Publish package
run: poetry publish --build
with:
working-directory: python/aptos-indexer-protos