Skip to content

Commit

Permalink
Merge pull request #148 from deggja/chore/revert-workflows
Browse files Browse the repository at this point in the history
chore: revert workflows
  • Loading branch information
deggja authored May 26, 2024
2 parents c1fa182 + 0e9dfd7 commit 737652a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
22 changes: 7 additions & 15 deletions .github/scripts/bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ if [ ! -z "$latest_tag" ]; then
IFS='.' read -r major minor patch <<< "${latest_tag}"
fi

new_tag="$major.$minor.$patch"

# Analyze commit messages since the last tag for versioning
for commit in $(git rev-list $latest_tag..HEAD); do
message=$(git log --format=%B -n 1 $commit)
Expand All @@ -24,26 +22,20 @@ for commit in $(git rev-list $latest_tag..HEAD); do
let major+=1
minor=0
patch=0
new_tag="${major}.${minor}.${patch}"
break
elif [[ $message == *"#minor"* ]]; then
let minor+=1
patch=0
new_tag="${major}.${minor}.${patch}"
elif [[ $message == *"#patch"* ]]; then
let patch+=1
new_tag="${major}.${minor}.${patch}"
fi
done

# Check if new version is different from the latest tag
if [ "$new_tag" != "$latest_tag" ]; then
# Set output for the next steps using environment file
echo "new_tag=$new_tag" >> $GITHUB_ENV
new_tag="${major}.${minor}.${patch}"

# Create the new tag
git tag $new_tag
git push --tags
else
echo "new_tag=" >> $GITHUB_ENV
fi
# Set output for the next steps using environment file
echo "new_tag=$new_tag" >> $GITHUB_ENV

# Create the new tag
git tag $new_tag
git push --tags
8 changes: 0 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,8 @@ jobs:
run: |
chmod +x .github/scripts/bump_version.sh
.github/scripts/bump_version.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build Application
if: env.new_tag != ''
run: |
go build -ldflags "-X 'github.com/deggja/netfetch/backend/cmd.Version=${{ env.new_tag }}'" -o netfetch
- name: Run GoReleaser
if: env.new_tag != ''
uses: goreleaser/goreleaser-action@v2
with:
version: latest
Expand Down

0 comments on commit 737652a

Please sign in to comment.