Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release gha #20

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: release
on:
workflow_dispatch:
inputs:
whtRelease:
description: 'The wht release, e.g. v0.0.1-rc.1'
required: true
type: string
releaseRef:
description: 'The branch from which the release will be created'
required: true
type: string
default: 'main'
jobs:
release:
name: release
runs-on: ubuntu-latest
env:
VERSION: ${{ inputs.whtRelease }}
GH_TOKEN: ${{ secrets.PAT }}
steps:
- name: checkout
id: checkout
uses: actions/checkout@v4
continue-on-error: true
with:
ref: ${{ inputs.releaseRef }}
fetch-depth: 0

# If releaseRef doesn't exist checkout the `main` branch
- name: fallback to main
if: steps.checkout.outcome == 'failure'
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0

- name: setup python
uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: setup git config
run: |
git config --global user.email "[email protected]"
git config --global user.name "devops-github-rudderstack"

- name: set version and create tag
run: |
VERS=$VERSION make update_version
git add . && git commit -m "chore: release ${VERSION}"
git tag -a ${VERSION} -m "release ${VERSION}"

- name: pip install
shell: bash
run: pip install wheel setuptools

- name: build profiles-pycorelib wheel
shell: bash
run: |
python setup.py bdist_wheel

- name: prepare dist archive
shell: bash
run: |
ls -la
ls -la dist
tar -czvf profiles_pycorelib_dist_${VERSION}.tar.gz dist

- name: push tag and create release
shell: bash
run: |
git push origin ${VERSION}
gh release create ${VERSION} --generate-notes profiles_pycorelib_dist_${VERSION}.tar.gz dist/*.whl
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ output/
build
__pycache__
.vscode
.DS_Store
.DS_Store
dist/
18 changes: 7 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
PRODUCT_NAME=profiles-pycorelib

VERS=0.11.0
GIT_COMMIT=`git rev-parse --short HEAD`
VERS_DATE=`date -u +%Y-%m-%d\ %H:%M`
VERS?=0.11.0
VERS_FILE=./version.py

.PHONY: update_version
update_version:
/bin/rm -f $(VERS_FILE)
@echo "# WARNING: auto-generated by Makefile release target -- run 'make release' to update" > $(VERS_FILE)
@echo "" >> $(VERS_FILE)
@echo "version = \"$(VERS)\"" >> $(VERS_FILE)
@echo "git_commit = \"$(GIT_COMMIT)\" # the commit JUST BEFORE the release" >> $(VERS_FILE)
@echo "version_date = \"$(VERS_DATE)\" # UTC" >> $(VERS_FILE)
/bin/cat $(VERS_FILE)

.PHONY: check_git
check_git:
@if [ "a" != "a$$(git status --untracked-files=no --porcelain)" ]; \
then \
Expand All @@ -27,14 +22,15 @@ check_git:
fi
@echo "Are you sure you want to make release version $(VERS)? The command will update setup.py and commit and push new git tag. [y/N] " && read ans && [ $${ans:-N} = y ]

# This is required for release process. make release updates the version and creates the tag for release

# TODO: this needs to be removed after the new release process is established
.PHONY: release
release: check_git update_version
git commit -am "v$(VERS) release"
git tag -a v$(VERS) -m "v$(VERS) release"
git push
git push origin --tags

.PHONY: install
install:
SKIP_PB_BIN=true pip3 install .

.PHONY: update_version check_git release install
3 changes: 0 additions & 3 deletions version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# WARNING: auto-generated by Makefile release target -- run 'make release' to update

version = "0.11.0"
git_commit = "9e001e4" # the commit JUST BEFORE the release
version_date = "2024-02-28 10:34" # UTC