diff --git a/.github/workflows/autorelease.yml b/.github/workflows/autorelease.yml deleted file mode 100644 index e3916e0..0000000 --- a/.github/workflows/autorelease.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: 🔖 Auto release gh action - -on: - workflow_dispatch: - schedule: - - cron: '0 0 * * 0' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Check out code - 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: Create release and tag - if: ${{ steps.get_commit.outputs.COMMIT_COUNT > 0 }} - id: tag_version - uses: mathieudutour/github-tag-action@v6.1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Create a GitHub release - if: ${{ steps.get_commit.outputs.COMMIT_COUNT > 0 }} - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.tag_version.outputs.new_tag }} - release_name: Release ${{ steps.tag_version.outputs.new_tag }} - body: ${{ steps.tag_version.outputs.changelog }} \ No newline at end of file diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml deleted file mode 100644 index aac400e..0000000 --- a/.github/workflows/build-test.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: 🔨 Build Test - -on: - workflow_dispatch: - push: - branches: - - develop - pull_request: - branches: - - main - - develop - - feature* - paths: - - '**.go' - - '**.mod' -jobs: - build: - name: Test Builds - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ ubuntu-latest, windows-latest, macOS-12 ] - go-version: [ 1.21.x ] - steps: - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: ${{ matrix.go-version }} - - - name: Check out code - uses: actions/checkout@v3 - - - name: Build - run: go build . - working-directory: cmd/hednsextractor/ - - - name: Test - run: go test ./... - working-directory: . - - - name: Install - run: go install - working-directory: cmd/hednsextractor/ - - - name: Race Condition Tests - run: go build -race . - working-directory: cmd/hednsextractor/ - - diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml new file mode 100644 index 0000000..3ec0b8e --- /dev/null +++ b/.github/workflows/code-quality.yml @@ -0,0 +1,113 @@ +name: Code Quality + +on: + workflow_call: + inputs: + create_pr: + description: 'Create a pull request from the current branch to the target branch' + required: false + type: boolean + default: false + pr_target_branch: + description: 'Target branch for the created PR' + required: false + type: string + default: 'develop' + upload_executable: + description: 'Upload test executable as artifact' + required: false + type: boolean + default: false + secrets: + REPO_PAT: + description: 'Optional Personal Access Token to create pull requests when GITHUB_TOKEN is restricted' + required: false + +permissions: + contents: write + pull-requests: write + +jobs: + code-quality: + name: Code Quality Validation + runs-on: ${{ matrix.os }} + outputs: + has_warnings: ${{ steps.set-has-warnings.outputs.has_warnings }} + warnings_count: ${{ steps.set-has-warnings.outputs.warnings_count }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + go-version: [1.21.x] + steps: + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go-version }} + + - name: Check out code + uses: actions/checkout@v4 + + - name: Build + run: go build . + working-directory: cmd/hednsextractor/ + + - name: Test + run: go test ./... + working-directory: . + + - name: Install + run: go install + working-directory: cmd/hednsextractor/ + + - name: Race Condition Tests + if: matrix.os == 'ubuntu-latest' + run: go build -race . + working-directory: cmd/hednsextractor/ + + - name: Install golangci-lint + if: matrix.os == 'ubuntu-latest' + run: | + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v1.59.0 + shell: bash + + - name: Run golangci-lint and generate warnings + if: matrix.os == 'ubuntu-latest' + id: run-lint + run: | + set -euo pipefail + golangci-lint run ./... --out-format tab > all-warnings.md || true + shell: bash + + - name: Expose Warnings Flag + id: set-has-warnings + if: always() + run: | + if [ -f all-warnings.md ] && [ -s all-warnings.md ]; then + echo "has_warnings=true" >> $GITHUB_OUTPUT + echo "warnings_count=$(wc -l < all-warnings.md | tr -d ' ')" >> $GITHUB_OUTPUT + else + echo "has_warnings=false" >> $GITHUB_OUTPUT + echo "warnings_count=0" >> $GITHUB_OUTPUT + fi + shell: bash + + - name: Upload Warnings Report + if: steps.set-has-warnings.outputs.has_warnings == 'true' + uses: actions/upload-artifact@v4 + with: + name: warnings-report + path: all-warnings.md + + sonarqube: + name: SonarQube Analysis + runs-on: ubuntu-latest + needs: code-quality + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: 1.24.x + \ No newline at end of file diff --git a/.github/workflows/dep-auto-merge.yml b/.github/workflows/dep-auto-merge.yml deleted file mode 100644 index 84b26e1..0000000 --- a/.github/workflows/dep-auto-merge.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: 🤖 dep auto merge - -on: - pull_request: - branches: - - dev - workflow_dispatch: - -permissions: - pull-requests: write - issues: write - repository-projects: write - -jobs: - automerge: - runs-on: ubuntu-latest - if: github.actor == 'dependabot[bot]' - steps: - - uses: actions/checkout@v3 - with: - token: ${{ secrets.DEPENDABOT_PAT }} - - - uses: ahmadnassri/action-dependabot-auto-merge@v2 - with: - github-token: ${{ secrets.DEPENDABOT_PAT }} - target: all \ No newline at end of file diff --git a/.github/workflows/develop-branch.yml b/.github/workflows/develop-branch.yml new file mode 100644 index 0000000..9ce46b8 --- /dev/null +++ b/.github/workflows/develop-branch.yml @@ -0,0 +1,21 @@ +name: Develop Branch CI + +permissions: + contents: write + pull-requests: write + +on: + push: + branches: [develop] + pull_request: + branches: [main] + +jobs: + quality-check: + uses: ./.github/workflows/code-quality.yml + with: + create_pr: true + pr_target_branch: main + permissions: + contents: write + pull-requests: write diff --git a/.github/workflows/feature-branch.yml b/.github/workflows/feature-branch.yml new file mode 100644 index 0000000..ae60644 --- /dev/null +++ b/.github/workflows/feature-branch.yml @@ -0,0 +1,21 @@ +name: Feature Branch CI + +permissions: + contents: write + pull-requests: write + +on: + push: + branches: ["feature/**"] + pull_request: + branches: [develop] + +jobs: + quality-check: + uses: ./.github/workflows/code-quality.yml + with: + create_pr: true + pr_target_branch: develop + permissions: + contents: write + pull-requests: write diff --git a/.github/workflows/main-branch.yml b/.github/workflows/main-branch.yml new file mode 100644 index 0000000..7fae5c3 --- /dev/null +++ b/.github/workflows/main-branch.yml @@ -0,0 +1,16 @@ +name: Main Branch CI + +on: + pull_request: + branches: [main] + +permissions: + contents: write + pull-requests: write + +jobs: + quality-check: + uses: ./.github/workflows/code-quality.yml + permissions: + contents: write + pull-requests: write diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..041e0d6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release + +on: + push: + branches: + - main + +jobs: + release: + name: Semantic Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: npm install -g semantic-release @semantic-release/changelog @semantic-release/git @semantic-release/github + + - name: Run semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + npx semantic-release + +# Observações: +# - semantic-release começará a partir da tag v1.0.7 já existente na main. +# - Releases automáticos apenas em main. +# - Plugins changelog/git/github já incluídos para integração completa. +# - Certifique-se de que o GITHUB_TOKEN tem permissões de write:packages, write:repo_hook, etc. diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..4093b14 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,22 @@ +{ + "branches": ["main"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + [ + "@semantic-release/exec", + { + "prepareCmd": "bash ./update_version.sh ${nextRelease.version}" + } + ], + [ + "@semantic-release/git", + { + "assets": ["utils/banner.go", "CHANGELOG.md"], + "message": "chore(release): ${nextRelease.version} [skip ci]" + } + ], + "@semantic-release/github" + ] +} diff --git a/cmd/hednsextractor/hednsextractor.go b/cmd/hednsextractor/hednsextractor.go index 7f002e5..bff776c 100644 --- a/cmd/hednsextractor/hednsextractor.go +++ b/cmd/hednsextractor/hednsextractor.go @@ -69,13 +69,13 @@ func main() { if utils.OptionCmd.Vtscore { virustotal := utils.Virustotal{} result.VtScore = virustotal.GetVtReport(result.Domain) - if score, err := strconv.ParseUint(utils.OptionCmd.VtscoreValue, 10, 64); err == nil { - if result.VtScore < score { - continue - } - } else { + score, err := strconv.ParseUint(utils.OptionCmd.VtscoreValue, 10, 64) + if err != nil { gologger.Fatal().Msg("Invalid parameter value for vt-score") } + if result.VtScore < score { + continue + } } var output = prepareOutput(result, bMatchedDomain, bMatchedPTR) @@ -86,9 +86,9 @@ func main() { for _, output := range outputs { if utils.OptionCmd.Silent { - gologger.Silent().Msgf(output) + gologger.Silent().Msgf("%s", output) } else { - gologger.Info().Msgf(output) + gologger.Info().Msgf("%s", output) } } } diff --git a/go.mod b/go.mod index 51d8e6c..47fb6e0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/HuntDownProject/hednsextractor -go 1.21 +go 1.24.0 require ( github.com/PuerkitoBio/goquery v1.9.2 @@ -64,14 +64,14 @@ require ( github.com/zmap/zcrypto v0.0.0-20231219022726-a1f61fb1661c // indirect go.etcd.io/bbolt v1.3.9 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.22.0 // indirect + golang.org/x/crypto v0.45.0 // indirect golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect - golang.org/x/tools v0.20.0 // indirect + golang.org/x/mod v0.29.0 // indirect + golang.org/x/net v0.47.0 // indirect + golang.org/x/sync v0.18.0 // indirect + golang.org/x/sys v0.38.0 // indirect + golang.org/x/text v0.31.0 // indirect + golang.org/x/tools v0.38.0 // indirect gopkg.in/djherbis/times.v1 v1.3.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect -) +) \ No newline at end of file diff --git a/go.sum b/go.sum index 3c09e97..8302390 100644 --- a/go.sum +++ b/go.sum @@ -212,14 +212,14 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= +golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA= +golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= @@ -234,15 +234,15 @@ golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I= +golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -263,8 +263,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= +golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -286,14 +286,14 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= +golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= -golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= +golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ= +golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= @@ -317,4 +317,4 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= \ No newline at end of file diff --git a/update_version.sh b/update_version.sh new file mode 100644 index 0000000..abf91da --- /dev/null +++ b/update_version.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# update_version.sh +# Atualiza a linha da versão no utils/banner.go para refletir a versão do release + +set -e + +VERSION=$1 +FILE="utils/banner.go" + +if [[ -z "$VERSION" ]]; then + echo "Uso: $0 " + exit 1 +fi + +# Atualiza a linha da versão +sed -i.bak -E "s/var version = \".*\"/var version = \"v$VERSION\"/" "$FILE" +rm -f "$FILE.bak"