Skip to content

Commit 7d76a1b

Browse files
authored
Merge pull request #42 from nitrictech/feature/release-workflow
Release workflow
2 parents 1d3aafa + 941b583 commit 7d76a1b

31 files changed

Lines changed: 191 additions & 152 deletions

.github/workflows/draft_release.yaml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/publish.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ jobs:
1111
- name: Checkout
1212
uses: actions/checkout@v2.3.1
1313
with:
14-
token: ${{secrets.SUBMOD_PAT}}
15-
submodules: recursive
1614
fetch-depth: 0 # needed to retrieve most recent tag
1715
- name: Set up Python 3.8
1816
uses: actions/setup-python@v2

.github/workflows/rc-release.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release Candidate
2+
on:
3+
pull_request:
4+
types: [closed]
5+
branches:
6+
- 'develop'
7+
8+
jobs:
9+
# Bump the SDK version
10+
version_bump:
11+
if: github.event.pull_request.merged == true
12+
name: Bump Version and Create Release
13+
runs-on: ubuntu-latest
14+
outputs:
15+
version_id: ${{ steps.tag_version.outputs.new_tag }}
16+
upload_url: ${{ steps.create_release.outputs.upload_url }}
17+
steps:
18+
- uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0
21+
- name: Bump version and push tag
22+
id: tag_version
23+
uses: mathieudutour/github-tag-action@v5.5
24+
with:
25+
# Don't commit tag
26+
# this will be done as part of the release
27+
dry_run: true
28+
github_token: ${{ secrets.GITHUB_TOKEN }}
29+
release_branches: main,develop
30+
31+
- name: Calculate RC number
32+
id: vars
33+
run: echo "::set-output name=rc_num::$(git rev-list --merges --count origin/develop...origin/main)"
34+
35+
- name: Create a GitHub release
36+
id: create_release
37+
uses: actions/create-release@v1
38+
env:
39+
# Use NITRIC_BOT_TOKEN here to
40+
# trigger release 'published' workflows
41+
GITHUB_TOKEN: ${{ secrets.NITRIC_BOT_TOKEN }}
42+
with:
43+
prerelease: true
44+
tag_name: ${{ steps.tag_version.outputs.new_tag }}-rc.${{ steps.vars.outputs.rc_num }}
45+
release_name: Release ${{ steps.tag_version.outputs.new_tag }}-rc.${{ steps.vars.outputs.rc_num }}
46+
body: ${{ steps.tag_version.outputs.changelog }}

.github/workflows/release.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Production Release
2+
on:
3+
pull_request:
4+
types: [closed]
5+
branches:
6+
- 'main'
7+
jobs:
8+
# Bump the SDK version
9+
version_bump:
10+
if: github.event.pull_request.merged == true
11+
name: Bump Version and Create Release
12+
runs-on: ubuntu-latest
13+
outputs:
14+
version_id: ${{ steps.tag_version.outputs.new_tag }}
15+
upload_url: ${{ steps.create_release.outputs.upload_url }}
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Bump version and push tag
21+
id: tag_version
22+
uses: mathieudutour/github-tag-action@v5.5
23+
with:
24+
# Use GITHUB_TOKEN here to prevent further workflows
25+
# generated on 'tag' action
26+
github_token: ${{ secrets.GITHUB_TOKEN }}
27+
- name: Create a GitHub release
28+
id: create_release
29+
uses: actions/create-release@v1
30+
env:
31+
# Use NITRIC_BOT_TOKEN here to
32+
# trigger release 'published' workflows
33+
GITHUB_TOKEN: ${{ secrets.NITRIC_BOT_TOKEN }}
34+
with:
35+
tag_name: ${{ steps.tag_version.outputs.new_tag }}
36+
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
37+
body: ${{ steps.tag_version.outputs.changelog }}

.github/workflows/test.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ jobs:
2626
python-version: ${{ matrix.python-version }}
2727
- name: Install
2828
run: make install
29-
- name: Generate gRPC Client
30-
run: make grpc-client
3129
- name: Run Tox
3230
# Run tox using the version of Python in `PATH`
3331
run: tox -e py

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

contracts

Lines changed: 0 additions & 1 deletion
This file was deleted.

makefile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,8 @@ install:
33
@pip3 install -e .[dev]
44
@pre-commit install
55

6-
OUTPUT="./nitric/proto"
7-
CONTRACTS="./contracts/proto"
8-
96
.PHONY: docs clean license
107

11-
grpc-client:
12-
@echo Generating Proto Sources
13-
@echo $(OUTPUT)
14-
@mkdir -p $(OUTPUT)
15-
@python3 -m grpc_tools.protoc -I $(CONTRACTS) --python_betterproto_out=$(OUTPUT) ./contracts/proto/**/**/*.proto
16-
178
docs:
189
@echo Generating SDK Documentation
1910
@pdoc3 -f --html -o docs nitric
@@ -30,7 +21,7 @@ license:
3021
@licenseheaders -t tools/apache-2.tmpl -o "Nitric Technologies Pty Ltd" -y 2021 -n "Nitric Python 3 SDK" -u "https://github.com/nitrictech/python-sdk" -d tests
3122
@licenseheaders -t tools/apache-2.tmpl -o "Nitric Technologies Pty Ltd" -y 2021 -n "Nitric Python 3 SDK" -u "https://github.com/nitrictech/python-sdk" -d tools
3223

33-
build: clean install grpc-client license docs
24+
build: clean install license docs
3425
@echo Building sdist and wheel
3526
@python3 setup.py sdist bdist_wheel
3627

nitric/api/documents.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@
2626

2727
from nitric.api.const import MAX_SUB_COLLECTION_DEPTH
2828
from nitric.api.exception import exception_from_grpc_error
29-
from nitric.proto.nitric.document.v1 import (
29+
from nitricapi.nitric.document.v1 import (
3030
DocumentServiceStub,
3131
Collection as CollectionMessage,
3232
Key as KeyMessage,
3333
Expression as ExpressionMessage,
3434
ExpressionValue,
3535
Document as DocumentMessage,
3636
)
37+
3738
from nitric.utils import new_default_channel, _dict_from_struct, _struct_from_dict
3839

3940
NIL_DOC_ID = ""
@@ -228,7 +229,7 @@ def is_sub_collection(self):
228229
return self.parent is not None
229230

230231
def to_collection_ref(self):
231-
"""Return this collection group as a collection ref"""
232+
"""Return this collection group as a collection ref."""
232233
return CollectionRef(
233234
self._documents,
234235
self.name,
@@ -241,7 +242,7 @@ def to_collection_ref(self):
241242

242243
@staticmethod
243244
def from_collection_ref(collectionRef: CollectionRef, documents: Documents) -> CollectionGroupRef:
244-
"""Return a collection ref as a collection group"""
245+
"""Return a collection ref as a collection group."""
245246
if collectionRef.parent is not None:
246247
return CollectionGroupRef(
247248
documents,

nitric/api/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
from nitric.api.exception import exception_from_grpc_error
2626
from nitric.utils import new_default_channel, _struct_from_dict
27-
from nitric.proto.nitric.event.v1 import EventServiceStub, NitricEvent, TopicServiceStub
27+
from nitricapi.nitric.event.v1 import EventServiceStub, NitricEvent, TopicServiceStub
2828
from dataclasses import dataclass, field
2929

3030

0 commit comments

Comments
 (0)