Skip to content

Commit

Permalink
add version bump steps (#232)
Browse files Browse the repository at this point in the history
* add version bump steps

* change file path

* commit to last commit

* change name of the step

* add condition
  • Loading branch information
dogancanbakir authored Sep 20, 2023
1 parent b367809 commit 9f18397
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
37 changes: 34 additions & 3 deletions .github/workflows/autorelease-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: 🔖 Auto release gh action
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0'
- cron: "0 0 * * 0"

jobs:
build:
Expand All @@ -13,11 +13,42 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get Commit Count
id: get_commit
run: git rev-list `git rev-list --tags --no-walk --max-count=1`..HEAD --count | xargs -I {} echo COMMIT_COUNT={} >> $GITHUB_OUTPUT

- name: Set up Go
if: ${{ steps.get_commit.outputs.COMMIT_COUNT > 0 }}
uses: actions/setup-go@v4
with:
go-version: 1.20.x

- name: Bump version
if: ${{ steps.get_commit.outputs.COMMIT_COUNT > 0 }}
run: |
curl -LO https://raw.githubusercontent.com/projectdiscovery/utils/main/scripts/versionbump/versionbump.go
go run versionbump.go -file cmd/mapcidr/main.go -var version -part patch
- name: Create local changes
if: ${{ steps.get_commit.outputs.COMMIT_COUNT > 0 }}
run: |
git add cmd/mapcidr/main.go
- name: Commit files
if: ${{ steps.get_commit.outputs.COMMIT_COUNT > 0 }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -am "Bump version"
- name: Push changes
if: ${{ steps.get_commit.outputs.COMMIT_COUNT > 0 }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}

- name: Create release and tag
if: ${{ steps.get_commit.outputs.COMMIT_COUNT > 0 }}
id: tag_version
Expand All @@ -33,4 +64,4 @@ jobs:
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
body: ${{ steps.tag_version.outputs.changelog }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vscode
.devcontainer
mapcidr
cmd/mapcidr/mapcidr
cmd/integration-test/mapcidr
Expand Down

0 comments on commit 9f18397

Please sign in to comment.