Skip to content

Commit

Permalink
Automatically update flyteidl versions when a github release is creat…
Browse files Browse the repository at this point in the history
…ed (#115)

* wip: Added version automatically in setup.py

Signed-off-by: yuvraj <[email protected]>

* wip: small fix

Signed-off-by: yuvraj <[email protected]>

* wip: small fix

Signed-off-by: yuvraj <[email protected]>

* wip: added npm version update

Signed-off-by: Yuvraj <[email protected]>

* wip: added workflow for master merge

Signed-off-by: Yuvraj <[email protected]>

* wip: added goreleaser for creating release

Signed-off-by: Yuvraj <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
  • Loading branch information
yindia authored and eapolinario committed Sep 13, 2023
1 parent bfa202d commit 1361056
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 2 deletions.
45 changes: 45 additions & 0 deletions flyteidl/.github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Master

on:
push:
branches:
- master

jobs:
bump-version:
name: Bump Version
runs-on: ubuntu-latest
needs: build-docker # Only to ensure it can successfully build
outputs:
version: ${{ steps.bump-version.outputs.tag }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Bump version and push tag
id: bump-version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch

goreleaser:
name: Goreleaser
runs-on: ubuntu-latest
needs: [bump-version]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: "0"
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.FLYTE_BOT_PAT }}
6 changes: 6 additions & 0 deletions flyteidl/.github/workflows/npmpublish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ jobs:
with:
node-version: "12.x"
registry-url: "https://registry.npmjs.org"
- name: Autobump version
run: |
# from refs/tags/v1.2.3 get 1.2.3
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
VERSION=$VERSION make update_npmversion
shell: bash
- run: npm install
- run: npm publish --access=public
env:
Expand Down
6 changes: 6 additions & 0 deletions flyteidl/.github/workflows/pythonpublish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Autobump version
run: |
# from refs/tags/v1.2.3 get 1.2.3
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
VERSION=$VERSION make update_pyversion
shell: bash
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand Down
9 changes: 9 additions & 0 deletions flyteidl/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
project_name: flyteidl
builds:
- skip: true
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
15 changes: 15 additions & 0 deletions flyteidl/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash

export REPOSITORY=flyteidl
include boilerplate/lyft/golang_test_targets/Makefile

Expand Down Expand Up @@ -40,3 +41,17 @@ install-piptools:
.PHONY: doc-requirements.txt
doc-requirements.txt: doc-requirements.in install-piptools
$(call PIP_COMPILE,doc-requirements.in)

PLACEHOLDER := "__version__\ =\ \"develop\""
PLACEHOLDER_NPM := \"version\": \"develop\"
VERSION := "v1.0.0"

.PHONY: update_pyversion
update_pyversion:
grep "$(PLACEHOLDER)" "setup.py"
sed -i "s/$(PLACEHOLDER)/__version__ = \"${VERSION}\"/g" "setup.py"

.PHONY: update_npmversion
update_npmversion:
grep "$(PLACEHOLDER_NPM)" "package.json"
sed -i "s/$(PLACEHOLDER_NPM)/\"version\": \"${VERSION}\"/g" "package.json"
2 changes: 1 addition & 1 deletion flyteidl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flyteorg/flyteidl",
"version": "0.18.18",
"version": "develop",
"description": "Compiled protocol buffers and gRPC service clients/servers for Flyte IDLs",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion flyteidl/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

__version__ = '0.18.18'
__version__ = "develop"

setup(
name='flyteidl',
Expand Down

0 comments on commit 1361056

Please sign in to comment.