From e5b886b69c04db3e4d0321187c329651ec68745c Mon Sep 17 00:00:00 2001 From: Kamandlou Date: Tue, 14 Jan 2025 22:38:03 +0330 Subject: [PATCH 1/3] add goreleaser --- .github/workflows/auto-realease.yml | 36 +++++----------- .gitignore | 2 + .goreleaser.yaml | 65 +++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 25 deletions(-) create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/auto-realease.yml b/.github/workflows/auto-realease.yml index 30f4af3..cba4ead 100644 --- a/.github/workflows/auto-realease.yml +++ b/.github/workflows/auto-realease.yml @@ -1,38 +1,24 @@ -name: Deploy - +name: Release on: push: - branches: - - main + tags: + - "v*.*.*" jobs: - init: - name: 🚩 Initialize - runs-on: ubuntu-latest - steps: - - name: Cancel previous workflow - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - release: - name: 🚀 Release - needs: init runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout code uses: actions/checkout@v3 - - name: Setup NodeJS - uses: actions/setup-node@v3 - with: - node-version: lts/* - - - name: Release + - name: Install GoReleaser env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - cp .github/.releaserc.yml . - npm i -g semantic-release @semantic-release/changelog @semantic-release/git - semantic-release + curl -sL https://git.io/goreleaser | bash + + - name: Run GoReleaser + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: goreleaser release --clean \ No newline at end of file diff --git a/.gitignore b/.gitignore index 70aaf78..41dc741 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ go.work.sum # env file .env .idea +# Added by goreleaser init: +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..7020b55 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,65 @@ +version: 2 + +before: + hooks: + - go mod tidy + +builds: + - id: "403unlockercli-linux" # Unique ID for this build + main: ./cmd/403unlockercli + env: + - CGO_ENABLED=0 + goos: + - linux + goarch: + - amd64 + - arm64 + + - id: "403unlockercli-windows" # Unique ID for this build + main: ./cmd/403unlockercli + env: + - CGO_ENABLED=0 + goos: + - windows + goarch: + - amd64 + + - id: "403unlockercli-darwin" # Unique ID for this build + main: ./cmd/403unlockercli + env: + - CGO_ENABLED=0 + goos: + - darwin + goarch: + - amd64 + - arm64 + +archives: + - format: tar.gz + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + format_overrides: + - goos: windows + format: zip + +checksum: + name_template: 'checksums.txt' + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + +release: + footer: >- + + --- + + Released by [GoReleaser](https://github.com/goreleaser/goreleaser). \ No newline at end of file From cb6e4137df2cb767cd1cce809002268ea7b05386 Mon Sep 17 00:00:00 2001 From: Kamandlou Date: Tue, 14 Jan 2025 22:41:23 +0330 Subject: [PATCH 2/3] update auto-realease.yml --- .github/workflows/auto-realease.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/auto-realease.yml b/.github/workflows/auto-realease.yml index cba4ead..7435609 100644 --- a/.github/workflows/auto-realease.yml +++ b/.github/workflows/auto-realease.yml @@ -12,13 +12,8 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Install GoReleaser - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - curl -sL https://git.io/goreleaser | bash - - name: Run GoReleaser env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: goreleaser release --clean \ No newline at end of file + run: | + curl -sL https://git.io/goreleaser | bash \ No newline at end of file From f9daa0b8c93d0a1cec8be610b33c0825a29d39f1 Mon Sep 17 00:00:00 2001 From: Kamandlou Date: Wed, 15 Jan 2025 15:54:55 +0330 Subject: [PATCH 3/3] update: set name for the binary output --- .goreleaser.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 7020b55..0a651a3 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -7,6 +7,7 @@ before: builds: - id: "403unlockercli-linux" # Unique ID for this build main: ./cmd/403unlockercli + binary: "403unlocker" env: - CGO_ENABLED=0 goos: @@ -17,6 +18,7 @@ builds: - id: "403unlockercli-windows" # Unique ID for this build main: ./cmd/403unlockercli + binary: "403unlocker" env: - CGO_ENABLED=0 goos: @@ -26,6 +28,7 @@ builds: - id: "403unlockercli-darwin" # Unique ID for this build main: ./cmd/403unlockercli + binary: "403unlocker" env: - CGO_ENABLED=0 goos: