-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:danielmiessler/fabric
- Loading branch information
Showing
16 changed files
with
318 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Update Version File | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Or whichever branch you want to monitor | ||
tags: | ||
- '*' # Trigger on any new tag | ||
|
||
permissions: | ||
contents: write # Ensure the workflow has write permissions | ||
|
||
jobs: | ||
update-version: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Fetch all history to include tags | ||
|
||
- name: Set up Git | ||
run: | | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
- name: Get the latest tag | ||
id: get_latest_tag | ||
run: | | ||
latest_tag=$(git describe --tags --abbrev=0) | ||
echo "Latest tag is: $latest_tag" | ||
echo "::set-output name=tag::$latest_tag" | ||
- name: Get the latest commit hash | ||
id: get_commit_hash | ||
run: | | ||
commit_hash=$(git rev-parse --short HEAD) | ||
echo "Commit hash is: $commit_hash" | ||
echo "::set-output name=commit_hash::$commit_hash" | ||
- name: Update version.go file | ||
run: | | ||
latest_tag=${{ steps.get_latest_tag.outputs.tag }} | ||
commit_hash=${{ steps.get_commit_hash.outputs.commit_hash }} | ||
echo "package main" > version.go | ||
echo "" >> version.go | ||
echo "var version = \"${latest_tag}-${commit_hash}\"" >> version.go | ||
- name: Commit changes | ||
run: | | ||
git add version.go | ||
git commit -m "Update version to ${{ steps.get_latest_tag.outputs.tag }} and commit ${{ steps.get_commit_hash.outputs.commit_hash }}" | ||
- name: Push changes | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use GITHUB_TOKEN to authenticate the push | ||
run: | | ||
git push origin main # Or the relevant branch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.