mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-02-17 01:12:08 -05:00
feat: clean up html readability; add autm. tag creation
This commit is contained in:
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -64,7 +64,7 @@ jobs:
|
||||
GOOS: ${{ env.OS }}
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
run: |
|
||||
go build -ldflags "-X main.version=$(git describe --tags --abbrev=0)" -o fabric-${OS}-${{ matrix.arch }} .
|
||||
go build -o fabric-${OS}-${{ matrix.arch }} .
|
||||
|
||||
- name: Build binary on Windows
|
||||
if: matrix.os == 'windows-latest'
|
||||
@@ -72,7 +72,7 @@ jobs:
|
||||
GOOS: windows
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
run: |
|
||||
go build -ldflags "-X main.version=$(git describe --tags --abbrev=0)" -o fabric-windows-${{ matrix.arch }}.exe .
|
||||
go build -o fabric-windows-${{ matrix.arch }}.exe .
|
||||
|
||||
- name: Upload build artifact
|
||||
if: matrix.os != 'windows-latest'
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
name: Update Version File
|
||||
name: Update Version and Create Tag
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main # Or whichever branch you want to monitor
|
||||
tags:
|
||||
- '*' # Trigger on any new tag
|
||||
- main # Monitor the main branch
|
||||
|
||||
permissions:
|
||||
contents: write # Ensure the workflow has write permissions
|
||||
@@ -28,32 +26,43 @@ jobs:
|
||||
- name: Get the latest tag
|
||||
id: get_latest_tag
|
||||
run: |
|
||||
latest_tag=$(git describe --tags --abbrev=0)
|
||||
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
|
||||
echo "Latest tag is: $latest_tag"
|
||||
echo "::set-output name=tag::$latest_tag"
|
||||
|
||||
- name: Get the latest commit hash
|
||||
id: get_commit_hash
|
||||
- name: Increment minor version
|
||||
id: increment_version
|
||||
run: |
|
||||
commit_hash=$(git rev-parse --short HEAD)
|
||||
echo "Commit hash is: $commit_hash"
|
||||
echo "::set-output name=commit_hash::$commit_hash"
|
||||
latest_tag=${{ steps.get_latest_tag.outputs.tag }}
|
||||
IFS='.' read -r major minor patch <<<"${latest_tag#v}"
|
||||
new_minor=$((minor + 1))
|
||||
new_tag="v${major}.${new_minor}.0"
|
||||
echo "New tag is: $new_tag"
|
||||
echo "::set-output name=new_tag::$new_tag"
|
||||
|
||||
- name: Update version.go file
|
||||
run: |
|
||||
latest_tag=${{ steps.get_latest_tag.outputs.tag }}
|
||||
commit_hash=${{ steps.get_commit_hash.outputs.commit_hash }}
|
||||
new_tag=${{ steps.increment_version.outputs.new_tag }}
|
||||
commit_hash=$(git rev-parse --short HEAD)
|
||||
echo "package main" > version.go
|
||||
echo "" >> version.go
|
||||
echo "var version = \"${latest_tag}-${commit_hash}\"" >> version.go
|
||||
echo "var version = \"${new_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 }}"
|
||||
git commit -m "Update version to ${{ steps.increment_version.outputs.new_tag }} and commit $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
|
||||
git push origin main # Push changes to the main branch
|
||||
|
||||
- name: Create a new tag
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
new_tag=${{ steps.increment_version.outputs.new_tag }}
|
||||
git tag $new_tag
|
||||
git push origin $new_tag # Push the new tag
|
||||
Reference in New Issue
Block a user