Skip to content

Commit a2581c2

Browse files
committed
search timestamp
1 parent 45d2d9f commit a2581c2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.github/workflows/fpm-version-update.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ jobs:
6161
- name: Update formula
6262
if: env.UPDATE_NEEDED == 'true'
6363
run: |
64+
# Replace the existing timestamp or add a new one at the top if it doesn't exist
65+
if grep -q "# Formula last updated on" Formula/fpm.rb; then
66+
# Replace the existing timestamp line
67+
sed -i "0,/# Formula last updated on/ c\# Formula last updated on $(date +'%Y-%m-%d %H:%M:%S')" Formula/fpm.rb
68+
else
69+
# If no timestamp line exists, add it at the top
70+
sed -i "1i\# Formula last updated on $(date +'%Y-%m-%d %H:%M:%S')" Formula/fpm.rb
71+
fi
6472
sed -i "1s|^|# Formula last updated on $(date +'%Y-%m-%d %H:%M:%S')\n|" Formula/fpm.rb
6573
sed -i "s|url \".*\"|url \"https://github.com/fortran-lang/fpm/releases/download/${LATEST_VERSION_V}/fpm-${LATEST_VERSION}.zip\"|" Formula/fpm.rb
6674
sed -i "s|sha256 \".*\"|sha256 \"${SHA256}\"|" Formula/fpm.rb

0 commit comments

Comments
 (0)