🔖 Release Tag #35
This file contains hidden or 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
name: 🔖 Release Tag | |
on: | |
workflow_run: | |
workflows: ["💡Fingerprint Update"] | |
types: | |
- completed | |
workflow_dispatch: | |
jobs: | |
bump-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.x | |
- name: Bump version in banner.go | |
working-directory: internal/runner | |
run: | | |
curl -LO https://raw.githubusercontent.com/projectdiscovery/utils/main/scripts/versionbump/versionbump.go | |
go run versionbump.go -file banner.go -var version -part patch | |
- name: Create local changes | |
working-directory: internal/runner | |
run: | | |
git add banner.go | |
- name: Commit files | |
working-directory: internal/runner | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git commit -am "Bump version" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
tag-release: | |
runs-on: ubuntu-latest | |
needs: bump-version | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.ref }} | |
- name: Pull latest changes | |
run: git pull origin ${{ github.ref }} | |
- name: Get latest version bump commit | |
id: get_latest_commit | |
run: | | |
git pull origin ${{ github.ref }} | |
echo "LATEST_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- 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: Create release and tag | |
if: ${{ steps.get_commit.outputs.COMMIT_COUNT > 0 }} | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.PDTEAMX_PAT }} | |
commit_sha: ${{ steps.get_latest_commit.outputs.LATEST_COMMIT }} | |
- name: Create a GitHub release | |
if: ${{ steps.get_commit.outputs.COMMIT_COUNT > 0 }} | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PDTEAMX_PAT }} | |
with: | |
tag_name: ${{ steps.tag_version.outputs.new_tag }} | |
release_name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} |