Skip to content

Commit fae6373

Browse files
jnnsbrrjnnsbrr
authored andcommitted
improve workflow
1 parent c797607 commit fae6373

3 files changed

Lines changed: 25 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ on:
55
tags: ['v*']
66

77
jobs:
8-
release:
8+
check-tag:
99
runs-on: ubuntu-latest
10-
permissions:
11-
contents: write
12-
10+
outputs:
11+
should-release: ${{ steps.check.outputs.should-release }}
1312
steps:
1413
- name: Checkout code
1514
uses: actions/checkout@v4
1615
with:
1716
fetch-depth: 0 # Fetch all history and tags
1817
fetch-tags: true # Ensure all tags are fetched for version resolution
1918

20-
- name: Verify tag is on main/master branch
19+
- name: Check if tag is on main/master branch
20+
id: check
2121
run: |
2222
# Get the commit that the tag points to
2323
TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref_name }})
@@ -26,14 +26,30 @@ jobs:
2626
# Check if this commit is reachable from main or master
2727
if git branch -r --contains $TAG_COMMIT | grep -E "(origin/main|origin/master)" > /dev/null; then
2828
echo "✅ Tag ${{ github.ref_name }} is on main/master branch"
29+
echo "should-release=true" >> $GITHUB_OUTPUT
2930
else
30-
echo " Tag ${{ github.ref_name }} is NOT on main/master branch"
31+
echo "⚠️ Tag ${{ github.ref_name }} is NOT on main/master branch"
3132
echo "Available branches containing this commit:"
3233
git branch -r --contains $TAG_COMMIT
3334
echo "This release will be skipped for security reasons."
34-
exit 1
35+
echo "To release, merge your changes to main/master first, then tag from there."
36+
echo "should-release=false" >> $GITHUB_OUTPUT
3537
fi
3638
39+
release:
40+
needs: check-tag
41+
if: needs.check-tag.outputs.should-release == 'true'
42+
runs-on: ubuntu-latest
43+
permissions:
44+
contents: write
45+
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0 # Fetch all history and tags
51+
fetch-tags: true # Ensure all tags are fetched for version resolution
52+
3753
- name: Set up Python
3854
uses: actions/setup-python@v5
3955
with:

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cff-version: 1.2.0
22
message: If you use this software, please cite it using the metadata from this file.
33
type: software
44
title: 'pycoupler: dynamic model coupling of LPJmL'
5-
version: 1.6.2
5+
version: 1.6.3
66
date-released: '2025-09-22'
77
abstract: An LPJmL-Python interface for operating LPJmL in a Python environment
88
and coupling it with Python models, programmes or simple programming scripts.

pycoupler/release.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def main():
338338
print("CITATION.cff updated, committing changes...")
339339
run_command("git add CITATION.cff", "Adding CITATION.cff to staging")
340340
run_command(
341-
f'git commit -m "Release version {version}\\n\\n- Update CITATION.cff to version {version}"', # noqa: E501
341+
f'git commit -m "Version {version}"',
342342
"Committing CITATION.cff changes",
343343
)
344344
print("CITATION.cff changes committed successfully.")

0 commit comments

Comments
 (0)