Skip to content

Commit fc522d4

Browse files
authored
chore: add release pipeline
* chore: add release pipeline * fix: release pipeline * fix: release pipeline format
1 parent d6f7595 commit fc522d4

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

.github/workflows/release-package.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Release Package
2+
3+
on:
4+
push:
5+
tags:
6+
- 'emd-*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.x'
20+
21+
- name: Install Poetry
22+
run: |
23+
curl -sSL https://install.python-poetry.org | python3
24+
25+
- name: Get tag name and commit hash
26+
id: vars
27+
run: |
28+
TAG_NAME=${GITHUB_REF##*/}
29+
VERSION=${TAG_NAME#emd-}
30+
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
31+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
32+
echo "COMMIT_HASH=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV
33+
34+
- name: Update version and commit hash
35+
run: |
36+
sed -i 's/VERSION = ".*"/VERSION = "'"${{ env.VERSION }}"'"/' src/emd/revision.py
37+
sed -i 's/COMMIT_HASH = ".*"/COMMIT_HASH = "'"${{ env.COMMIT_HASH }}"'"/' src/emd/revision.py
38+
39+
- name: Build wheel
40+
run: poetry build -f wheel
41+
42+
- name: Get tag name
43+
id: get_tag
44+
run: echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
45+
46+
- name: Rename wheel
47+
run: |
48+
WHEEL_FILE=$(ls dist/*.whl)
49+
mv "$WHEEL_FILE" "dist/${{ env.TAG_NAME }}.whl"
50+
51+
- name: Install GitHub CLI
52+
run: sudo apt-get install -y gh
53+
54+
- name: Create GitHub Release
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
run: |
58+
gh release create ${{ env.TAG_NAME }} dist/${{ env.TAG_NAME }}.whl --title "Release ${{ env.TAG_NAME }}" --notes "Automated release of ${{ env.TAG_NAME }}"

src/emd/revision.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# import importlib.metadata
2-
VERSION = "0.6.0" #importlib.metadata.version("emd")
2+
VERSION = "0.6.0"
33
COMMIT_HASH = "8c02decb"
44

55
def convert_version_name_to_stack_name(version_name:str):

0 commit comments

Comments
 (0)