Skip to content

Commit

Permalink
fix dirty goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
watzon committed Nov 22, 2024
1 parent 53cf2d3 commit 7225bfe
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,16 @@ jobs:

- name: Update version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
REVISION=$(git rev-parse HEAD)
DATE=$(date -u +%Y-%m-%d)
# Update version.go
cat > pkg/version/version.go << EOF
package version
const (
Version = "v${VERSION}"
Revision = "${REVISION}"
Date = "${DATE}"
)
EOF
# Commit and push changes
DATE=$(date -u +"%Y-%m-%d")
sed -i "s/const Version = \".*\"/const Version = \"${GITHUB_REF_NAME}\"/" pkg/version/version.go
sed -i "s/const Revision = \".*\"/const Revision = \"${GITHUB_SHA}\"/" pkg/version/version.go
sed -i "s/const Date = \".*\"/const Date = \"${DATE}\"/" pkg/version/version.go
sed -i "s/Standards-Version: \*.*\"/Standards-Version: \"${GITHUB_REF_NAME}\"/" build/debian/control
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add --all
git commit -m "Update version to v${VERSION}" || echo "No changes to commit"
git pull --rebase origin main || echo "Failed to rebase, continuing anyway"
git push origin HEAD:main || echo "Failed to push, continuing anyway"
git add pkg/version/version.go
git commit -m "Update version to ${GITHUB_REF_NAME}"
git push origin main
goreleaser:
needs: update-version
Expand Down

0 comments on commit 7225bfe

Please sign in to comment.