-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (32 loc) · 1.23 KB
/
update-readme.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Update README with Release Version
on:
workflow_dispatch:
release:
types: [published]
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch full history to allow branch operations
- name: Switch to Default Branch
run: |
# Determine the default branch dynamically
DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch" | cut -d' ' -f5)
git fetch origin $DEFAULT_BRANCH
git checkout $DEFAULT_BRANCH
- name: Extract Release Version
id: extract_version
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Update README.md with New Version
run: |
sed -i "s|multi_conn_ac-[0-9.]*-py3-none-any\.whl|multi_conn_ac-refs/heads/main-py3-none-any\.whl|" README.md
- name: Commit and Push Changes
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "Update README.md with version ${{ env.version }}"
git push origin HEAD