diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f621e10 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,63 @@ +name: Go Release Workflow + +on: + push: + branches: + - main + +jobs: + release: + name: Release Go Project + runs-on: ubuntu-latest + + steps: + # Step 1: Check out the repository + - name: Checkout repository + uses: actions/checkout@v3 + + # Step 2: Set up Go environment + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.18' # Specify your Go version + + # Step 3: Run go mod tidy and commit changes + - name: Run go mod tidy + run: | + go mod tidy + git config --global user.name "majidkarimizadeh" + git config --global user.email "m.karimizadeh@global.leaseweb.com" + git diff --quiet || ( + git add go.mod go.sum + git commit -m "chore: tidy go.mod and go.sum" + git push origin HEAD + ) + + # Step 4: Tag the release + - name: Create a Git tag + run: | + VERSION="v0.0.1-$(git rev-parse --short HEAD)" + git tag -a $VERSION -m "Release $VERSION" + git push origin $VERSION + + # Step 5: Run GoReleaser to create the release + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v4 + with: + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + automerge: + name: Enable Auto-Merge for Release Pull Requests + runs-on: ubuntu-latest + needs: release + + steps: + - name: Enable Auto-Merge + uses: "peter-evans/enable-pull-request-automerge@v2" + with: + token: ${{ secrets.GITHUB_TOKEN }} + pull-request-number: ${{ github.event.pull_request.number }} + merge-method: squash diff --git a/go.mod b/go.mod index c025511..679152a 100644 --- a/go.mod +++ b/go.mod @@ -1,14 +1,3 @@ module github.com/leaseweb/leaseweb-go-sdk go 1.22.9 - -require ( - github.com/leaseweb/leaseweb-go-sdk/abuse v0.0.0-20241219112543-85f6a9b47c9c - github.com/leaseweb/leaseweb-go-sdk/aggregationpack v0.0.0-20241219112543-85f6a9b47c9c - github.com/leaseweb/leaseweb-go-sdk/dedicatedserver v0.0.0-20241219112543-85f6a9b47c9c - github.com/leaseweb/leaseweb-go-sdk/dns v0.0.0-20241219112543-85f6a9b47c9c - github.com/leaseweb/leaseweb-go-sdk/invoice v0.0.0-20241219112543-85f6a9b47c9c - github.com/leaseweb/leaseweb-go-sdk/publiccloud v0.0.0-20241219112543-85f6a9b47c9c -) - -require gopkg.in/validator.v2 v2.0.1 // indirect diff --git a/go.sum b/go.sum deleted file mode 100644 index dff0cd1..0000000 --- a/go.sum +++ /dev/null @@ -1,20 +0,0 @@ -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/leaseweb/leaseweb-go-sdk/abuse v0.0.0-20241219112543-85f6a9b47c9c h1:pCrYxSqnnt91ZXy5jsc6dx1zFxBDkTSTJDqsx3o5QoE= -github.com/leaseweb/leaseweb-go-sdk/abuse v0.0.0-20241219112543-85f6a9b47c9c/go.mod h1:JT1mvUeyE8L5lxvvZAP5/WquN61guv6/tby9yNQn+iw= -github.com/leaseweb/leaseweb-go-sdk/aggregationpack v0.0.0-20241219112543-85f6a9b47c9c h1:9M1VvAk1X4aCau909Baa9NVfJc+t5tQX3xvm5agIQ2U= -github.com/leaseweb/leaseweb-go-sdk/aggregationpack v0.0.0-20241219112543-85f6a9b47c9c/go.mod h1:H1LTA7LmrB6XOXT7xB/cPevWEaKNcW+G/Kb5BhSZ8a4= -github.com/leaseweb/leaseweb-go-sdk/dedicatedserver v0.0.0-20241219112543-85f6a9b47c9c h1:R8IaiZdskLsoeO/IJR8VSMa11RG/liY7ruvxnRhd/MM= -github.com/leaseweb/leaseweb-go-sdk/dedicatedserver v0.0.0-20241219112543-85f6a9b47c9c/go.mod h1:ncbxW0PkYMXPtRBqNENpf9NA7w96wxeKDxSzXPO5h3M= -github.com/leaseweb/leaseweb-go-sdk/dns v0.0.0-20241219112543-85f6a9b47c9c h1:gOoB+BaQ6TMd5OWvtWbQfrhPVZlYG25GoH+KPsRLInU= -github.com/leaseweb/leaseweb-go-sdk/dns v0.0.0-20241219112543-85f6a9b47c9c/go.mod h1:A9nRyjMF+UuKa3NReJ4MwR4EXOOUWTSkkupbqeGvfSc= -github.com/leaseweb/leaseweb-go-sdk/invoice v0.0.0-20241219112543-85f6a9b47c9c h1:0bYSMYAy8ctKy3n2bVSzLTh/qswqbuniYUUtSFB0AJE= -github.com/leaseweb/leaseweb-go-sdk/invoice v0.0.0-20241219112543-85f6a9b47c9c/go.mod h1:1yBORV6nXfu9suPXGjtqgaxDe/JFzktoA/+X57lWjuI= -github.com/leaseweb/leaseweb-go-sdk/publiccloud v0.0.0-20241219112543-85f6a9b47c9c h1:yzyPzvucxaUfgtO/RMPBH4IWTpsFkPOCgRP5zPvoY/k= -github.com/leaseweb/leaseweb-go-sdk/publiccloud v0.0.0-20241219112543-85f6a9b47c9c/go.mod h1:wdUkTN87HmoILcSEpyppNvVpGhQ/v0EnOzq4Dn5yiII= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/validator.v2 v2.0.1 h1:xF0KWyGWXm/LM2G1TrEjqOu4pa6coO9AlWSf3msVfDY= -gopkg.in/validator.v2 v2.0.1/go.mod h1:lIUZBlB3Im4s/eYp39Ry/wkR02yOPhZ9IwIRBjuPuG8=