-
Notifications
You must be signed in to change notification settings - Fork 7
87 lines (84 loc) · 2.82 KB
/
generate.yml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: cicd
on: [push]
jobs:
cicd:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
python-version: [2.7, 3.6]
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup Go and protoc
run: |
python do.py setup_ext
- name: Install dependencies
run: |
python do.py setup
python do.py init
- name: Build distribution
run: |
python do.py dist
- name: Install package on clean env
run: |
rm -rf .env
python do.py setup
python do.py install
- name: Commit go pkg
if: ${{ matrix.python-version == 3.6 }}
run: |
git config user.name "Github Actions Bot"
git config user.email "[email protected]"
git add --force gosnappi/\*
if git status --porcelain | grep .
then
git commit -m "Update auto generated go snappi"
git push
else
echo "No change in auto generated go snappi"
fi
- name: Run tests
run: |
sudo python do.py test
- name: Get package version
id: get_version
run: |
echo "::set-output name=version::v$(python do.py version)"
- name: Check tag for current version
uses: mukunku/[email protected]
id: check_tag
with:
tag: ${{ steps.get_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish package
if: steps.check_tag.outputs.exists == 'false' && matrix.python-version == '3.6'
run: |
PYPI_USERNAME=${{ secrets.PYPI_USERNAME }} PYPI_PASSWORD=${{ secrets.PYPI_PASSWORD }} python do.py release
- name: Create release and publish artifacts
if: steps.check_tag.outputs.exists == 'false' && matrix.python-version == '3.6'
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*,models-release"
tag: ${{ steps.get_version.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create tag for gosnappi
if: steps.check_tag.outputs.exists == 'false' && matrix.python-version == '3.6'
uses: actions/github-script@v3
with:
github-token: ${{ github.token }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/gosnappi/${{ steps.get_version.outputs.version }}",
sha: context.sha
})