@@ -50,16 +50,17 @@ jobs:
50
50
echo "exists=false" >> $GITHUB_OUTPUT
51
51
fi
52
52
53
- create-tag :
54
- name : Create tag if needed
53
+ update-citation :
54
+ name : Update CITATION.cff
55
55
needs : validate-tag
56
56
runs-on : ubuntu-latest
57
- if : needs.validate-tag.outputs.tag_exists == 'false' && github.event.inputs.create_tag == 'true'
58
57
59
58
steps :
60
59
- uses : actions/checkout@v4
60
+ with :
61
+ fetch-depth : 0 # Fetch all history for tags
61
62
62
- - name : Update CITATION.cff and create tag
63
+ - name : Update CITATION.cff
63
64
run : |
64
65
# Get current date in YYYY-MM-DD format
65
66
TODAY=$(date +"%Y-%m-%d")
@@ -92,23 +93,43 @@ jobs:
92
93
if ! git diff --quiet CITATION.cff; then
93
94
git add CITATION.cff
94
95
git commit -m "Update CITATION.cff to version $VERSION [skip ci]"
96
+ git push origin HEAD
97
+ else
98
+ echo "No changes to CITATION.cff"
95
99
fi
96
100
101
+ create-tag :
102
+ name : Create tag if needed
103
+ needs : [validate-tag, update-citation]
104
+ runs-on : ubuntu-latest
105
+ if : needs.validate-tag.outputs.tag_exists == 'false' && github.event.inputs.create_tag == 'true'
106
+
107
+ steps :
108
+ - uses : actions/checkout@v4
109
+ with :
110
+ ref : main # Get the latest main branch with CITATION.cff updates
111
+
112
+ - name : Create and push tag
113
+ run : |
114
+ # Configure git
115
+ git config user.name "github-actions[bot]"
116
+ git config user.email "github-actions[bot]@users.noreply.github.com"
117
+
97
118
# Create and push tag
98
119
git tag ${{ needs.validate-tag.outputs.tag }}
99
- git push origin HEAD
100
120
git push origin ${{ needs.validate-tag.outputs.tag }}
101
121
102
122
build :
103
123
name : Build distribution 📦
104
- needs : [validate-tag, create-tag]
105
- if : always() && needs.validate-tag.result == 'success' && (needs.create-tag.result == 'success' || needs.create-tag.result == 'skipped')
124
+ needs : [validate-tag, update-citation, create-tag]
125
+ if : always() && needs.validate-tag.result == 'success' && needs.update-citation.result == 'success' && (needs.create-tag.result == 'success' || needs.create-tag.result == 'skipped')
106
126
runs-on : ubuntu-latest
107
127
108
128
steps :
109
129
- uses : actions/checkout@v4
110
130
with :
111
- ref : ${{ needs.validate-tag.outputs.tag }}
131
+ # If tag exists, use it; otherwise use main branch with updated CITATION.cff
132
+ ref : ${{ needs.validate-tag.outputs.tag_exists == 'true' && needs.validate-tag.outputs.tag || 'main' }}
112
133
113
134
- name : Set up Python
114
135
uses : actions/setup-python@v5
0 commit comments