Skip to content

Commit

Permalink
Update git actions
Browse files Browse the repository at this point in the history
  • Loading branch information
SW999 committed Jul 13, 2024
1 parent e76a09f commit 101df66
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 35 deletions.
42 changes: 24 additions & 18 deletions .github/workflows/update-badge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,29 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags

- name: Get the latest tag
id: get_tag
run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
- name: Get the latest tag
id: get_tag
run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/}

- name: Update README with version badge
run: |
TAG=${{ steps.get_tag.outputs.tag }}
BADGE_URL="https://img.shields.io/badge/version-${TAG}-brightgreen"
sed -i "s|!\\[Version Badge\\](.*)|![Version Badge](${BADGE_URL})|" README.md
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add README.md
git commit -m "Update version badge to $TAG"
git push
- name: Update README with version badge
run: |
TAG=${{ steps.get_tag.outputs.tag }}
BADGE_URL="https://img.shields.io/badge/version-${TAG}-brightgreen"
sed -i "s|!\\[Version Badge\\](.*)|![Version Badge](${BADGE_URL})|" README.md
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git fetch origin
git checkout -B main origin/main # or the branch you are working on
git add README.md
git commit -m "Update version badge to ${{ steps.get_tag.outputs.tag }}"
git push origin HEAD:main # push changes to the same branch
40 changes: 23 additions & 17 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,28 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags

- name: Get the latest tag
id: get_tag
run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
- name: Get the latest tag
id: get_tag
run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/}

- name: Update version in HTML
run: |
TAG=${{ steps.get_tag.outputs.tag }}
sed -i "s/VERSION_PLACEHOLDER/$TAG/" index.html
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add index.html
git commit -m "Update version to $TAG"
git push
- name: Update version in HTML
run: |
TAG=${{ steps.get_tag.outputs.tag }}
sed -i "s/VERSION_PLACEHOLDER/$TAG/" index.html
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git fetch origin
git checkout -B main origin/main # or the branch you are working on
git add index.html
git commit -m "Update version to ${{ steps.get_tag.outputs.tag }}"
git push origin HEAD:main # push changes to the same branch

0 comments on commit 101df66

Please sign in to comment.