diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..c546e8e --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,9 @@ +# source: https://github.com/marketplace/actions/release-drafter#configuration +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' +version-resolver: + default: minor +template: | + _No changelog for now!_ \ No newline at end of file diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index c6bad3d..0000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: Go - -on: - push: - branches: [ main ] - -jobs: - build_and_release: - name: Build - runs-on: ubuntu-latest - steps: - - - name: Set up Go 1.x - uses: actions/setup-go@v2 - with: - go-version: ^1.20 - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Get dependencies - run: | - go get -v -t -d ./... - if [ -f Gopkg.toml ]; then - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - dep ensure - fi - - - name: Build for Linux - run: go build -v -o=bin/linux ./... - - - name: Build for Mac Intel - run: GOOS=darwin GOARCH=amd64 go build -v -o=bin/mac/intel ./... - - - name: Build for Mac M1 - run: GOOS=darwin GOARCH=arm64 go build -v -o=bin/mac/m1 ./... - - - name: Get current date time - id: current_datetime - run: echo "NOW=$(date +'%Y.%m.%d')" >> $GITHUB_ENV - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE_NAME: ${{ env.NOW }}.${{ github.run_number }} - with: - tag_name: ${{ env.RELEASE_NAME }} - release_name: Release ${{ env.RELEASE_NAME }} - draft: false - prerelease: false - - - name: Upload woodhouse for Linux - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./bin/linux/woodhouse - asset_name: woodhouse.linux.bin - asset_content_type: application/octet-stream - - - name: Upload woodhouse for Mac Intel - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./bin/mac/intel/woodhouse - asset_name: woodhouse.mac.intel.bin - asset_content_type: application/octet-stream - - - name: Upload woodhouse for Mac M1 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./bin/mac/m1/woodhouse - asset_name: woodhouse.mac.m1.bin - asset_content_type: application/octet-stream \ No newline at end of file diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..4548dbb --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,23 @@ +# source: https://github.com/marketplace/actions/release-drafter +name: Release drafter + +on: + push: + branches: + - main + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + contents: write + pull-requests: read + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + with: + disable-autolabeler: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b231930 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +# source: https://github.com/goreleaser/goreleaser-action +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: ^1.20 + + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index e13b1a5..98694cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ bin/*/* !bin/*/.keep -!bin/*/*/.keep \ No newline at end of file +!bin/*/*/.keep +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..62d4b48 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,21 @@ +# source: https://goreleaser.com +before: + hooks: + - go mod tidy + - go generate ./... +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + ldflags: + # source: https://goreleaser.com/customization/builds/#passing-environment-variables-to-ldflags + - -s -w -X "main.go={{.Version}}" +universal_binaries: + - replace: true +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next"