1818
1919
2020jobs :
21- tests :
22- name : Run tests
21+ test :
22+ name : Run test
2323 runs-on : ubuntu-latest
2424 steps :
2525 - name : Read Configuration
@@ -57,26 +57,89 @@ jobs:
5757 with :
5858 version : 1.2.1
5959
60- - name : Lint & test aserto package
60+ - name : Run lint
6161 run : |
62- cd packages/aserto
6362 poetry install
6463 poetry run pyright .
64+
65+ - name : Run tests
66+ run : |
6567 poetry run pytest -vv
66- cd ../..
68+ release :
69+ runs-on : ubuntu-latest
70+ needs : test
71+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
6772
68- - name : Lint & test aserto-idp package
69- run : |
70- cd packages/aserto-idp
71- poetry install
72- poetry run pyright .
73- poetry run pytest -vv
74- cd ../..
73+ name : Release to pypi
74+ steps :
75+ - name : Read Configuration
76+ uses : hashicorp/vault-action@v2.4.1
77+ id : vault
78+ with :
79+ url : ${{ env.VAULT_ADDR }}
80+ token : ${{ secrets.VAULT_TOKEN }}
81+ secrets : |
82+ kv/data/github "SSH_PRIVATE_KEY" | SSH_PRIVATE_KEY;
83+ kv/data/pypi "API_TOKEN" | POETRY_HTTP_BASIC_PYPI_PASSWORD;
84+
85+ - name : Checkout
86+ uses : actions/checkout@v3
87+ with :
88+ fetch-depth : 0
89+
90+ - name : Setup Go
91+ uses : actions/setup-go@v2
92+ with :
93+ go-version : ${{ env.GO_VERSION }}
94+
95+ - name : Setup caching
96+ uses : actions/cache@v2
97+ with :
98+ path : |
99+ ~/.cache/go-build
100+ ~/go/pkg/mod
101+ .ext
102+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum', 'Depfile') }}
103+ restore-keys : |
104+ ${{ runner.os }}-go-
105+
106+ - name : Install dependencies
107+ run : |
108+ mkdir -p $HOME/.ssh
109+ umask 0077 && echo -e "${SSH_PRIVATE_KEY}" > $HOME/.ssh/id_rsa
110+ ssh-keyscan github.com >> $HOME/.ssh/known_hosts
111+
112+ git config --global url."git@github.com:".insteadOf https://github.com/
113+ git config --global user.email "github-bot@aserto.com"
114+ git config --global user.name "Aserto Bot"
115+
116+ eval `ssh-agent`
117+ ssh-add $HOME/.ssh/id_rsa
118+
119+ go run mage.go deps
120+
121+ - name : Set up Python
122+ uses : actions/setup-python@v4
123+ with :
124+ python-version : ' 3.10'
125+
126+ - name : Install Poetry
127+ uses : snok/install-poetry@v1
128+
129+ - name : Build and push the python package
130+ env :
131+ # When using a PYPI API token, the user name must be set to "__token__"
132+ POETRY_HTTP_BASIC_PYPI_USERNAME : __token__
133+ run : go run mage.go release
134+
135+ - name : Bump to the next version
136+ run : go run mage.go bump patch
137+
138+ - name : Commit changes
139+ uses : EndBug/add-and-commit@v9
140+ with :
141+ default_author : github_actions
142+ message : ' Bump to next version'
143+ add : ' pyproject.toml'
144+ push : origin HEAD:main
75145
76- - name : Lint & test flask-aserto package
77- run : |
78- cd packages/flask-aserto
79- poetry install
80- poetry run pyright .
81- poetry run pytest -vv
82- cd ../..
0 commit comments