Skip to content

Commit b0c4192

Browse files
committed
[Copilot] consolidate release script
1 parent 7382593 commit b0c4192

File tree

1 file changed

+21
-43
lines changed

1 file changed

+21
-43
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -37,64 +37,42 @@ jobs:
3737
exit 1
3838
fi
3939
40-
- name: Create tags
40+
- name: Set package variables
4141
run: |
42-
git config --local user.email "action@github.com"
43-
git config --local user.name "GitHub Action"
42+
PACKAGE="${{ github.event.inputs.package }}"
43+
VERSION="${{ github.event.inputs.version }}"
4444
45-
if [[ "${{ github.event.inputs.package }}" == "core" ]]; then
46-
echo "Creating core tag: core-v${{ github.event.inputs.version }}"
47-
git tag core-v${{ github.event.inputs.version }}
48-
fi
45+
# Convert package name for different formats
46+
PACKAGE_HYPHEN=$(echo "$PACKAGE" | tr '_' '-') # public_health -> public-health
47+
PACKAGE_TITLE=$(echo "$PACKAGE" | sed 's/_/ /g' | sed 's/\b\w/\u&/g') # public_health -> Public Health
4948
50-
if [[ "${{ github.event.inputs.package }}" == "public_health" ]]; then
51-
echo "Creating public health tag: public-health-v${{ github.event.inputs.version }}"
52-
git tag public-health-v${{ github.event.inputs.version }}
53-
fi
49+
echo "TAG_NAME=${PACKAGE_HYPHEN}-v${VERSION}" >> $GITHUB_ENV
50+
echo "RELEASE_NAME=${PACKAGE_TITLE} Release v${VERSION}" >> $GITHUB_ENV
51+
echo "PYPI_NAME=sim-sci-test-monorepo-${PACKAGE_HYPHEN}" >> $GITHUB_ENV
5452
55-
- name: Push tags
53+
- name: Create and push tag
5654
run: |
57-
if [[ "${{ github.event.inputs.package }}" == "core" ]]; then
58-
git push origin core-v${{ github.event.inputs.version }}
59-
fi
60-
if [[ "${{ github.event.inputs.package }}" == "public_health" ]]; then
61-
git push origin public-health-v${{ github.event.inputs.version }}
62-
fi
55+
git config --local user.email "action@github.com"
56+
git config --local user.name "GitHub Action"
6357
64-
- name: Create Release for Core
65-
if: ${{ github.event.inputs.package == 'core' }}
66-
uses: softprops/action-gh-release@v1
67-
with:
68-
tag_name: core-v${{ github.event.inputs.version }}
69-
name: Core Release v${{ github.event.inputs.version }}
70-
body: |
71-
Core Release v${{ github.event.inputs.version }}
72-
73-
## Package Released
74-
- sim-sci-test-monorepo-core
75-
76-
## Installation
77-
```bash
78-
uv pip install sim-sci-test-monorepo-core==${{ github.event.inputs.version }}
79-
```
80-
draft: false
81-
prerelease: false
58+
echo "Creating tag: $TAG_NAME"
59+
git tag $TAG_NAME
60+
git push origin $TAG_NAME
8261
83-
- name: Create Release for Public Health
84-
if: ${{ github.event.inputs.package == 'public_health' }}
62+
- name: Create Release
8563
uses: softprops/action-gh-release@v1
8664
with:
87-
tag_name: public-health-v${{ github.event.inputs.version }}
88-
name: Public Health Release v${{ github.event.inputs.version }}
65+
tag_name: ${{ env.TAG_NAME }}
66+
name: ${{ env.RELEASE_NAME }}
8967
body: |
90-
Public Health Release v${{ github.event.inputs.version }}
68+
${{ env.RELEASE_NAME }}
9169
9270
## Package Released
93-
- sim-sci-test-monorepo-public-health
71+
- ${{ env.PYPI_NAME }}
9472
9573
## Installation
9674
```bash
97-
uv pip install sim-sci-test-monorepo-public-health==${{ github.event.inputs.version }}
75+
uv pip install ${{ env.PYPI_NAME }}==${{ github.event.inputs.version }}
9876
```
9977
draft: false
10078
prerelease: false

0 commit comments

Comments
 (0)