diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..24fe855 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,50 @@ +name: Build and Release + +on: + push: + tags: + - 'v*' + branches: + - '**' + pull_request: + +permissions: + contents: write + id-token: write + packages: write + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.23.3 + + - name: Build + if: ${{ github.ref_type != 'tag' }} + uses: goreleaser/goreleaser-action@v5 + with: + version: latest + args: build --clean --snapshot + + - name: Build + if: ${{ github.ref_type == 'tag' }} + uses: goreleaser/goreleaser-action@v5 + with: + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Artifacts (for non-tag builds) + if: ${{ github.ref_type != 'tag' }} + uses: actions/upload-artifact@v4 + with: + name: built-binaries + path: dist/* diff --git a/.gitignore b/.gitignore index d211cde..71f3c66 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,6 @@ config.yaml # Data directory data/ + +# goreleaser +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..fafccc2 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,36 @@ +project_name: super-sms-bridge + +builds: + - id: default + main: ./cmd/super-sms-bridge + binary: super-sms-bridge + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + env: + - CGO_ENABLED=0 + ldflags: "-s -w" + +archives: + - id: default + format: zip + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + files: + - LICENSE + - README.md + - config.example.yaml + +checksum: + name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt" + +release: + github: + owner: PA733 + name: SuperSMSBridge + +snapshot: + name_template: "{{ .Tag }}-dev"