diff --git a/.github/workflows/crossbuild.yml b/.github/workflows/crossbuild.yml index 1be3a7d..5c29731 100644 --- a/.github/workflows/crossbuild.yml +++ b/.github/workflows/crossbuild.yml @@ -1,6 +1,5 @@ -# From github.com/marketplace/actions/go-cross-build v1.0.2 # workflow name -name: crossbuild +name: Cross-build # on events on: @@ -8,11 +7,34 @@ on: types: - started +# This crossbuild from Kuechlin/gotris +#on: +# push: +# # Sequence of patterns matched against refs/tags +# tags: +# - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +permissions: + contents: write + +defaults: + run: + shell: bash + + # jobs jobs: # Build build: runs-on: ubuntu-latest + strategy: + matrix: + goosarch: + - 'linux/386' +# - 'linux/amd64' + - 'windows/386' +# - 'windows/amd64' + - 'linux/arm' steps: - uses: actions/checkout@v4 @@ -20,29 +42,25 @@ jobs: uses: actions/setup-go@v5 with: go-version: '1.22.1' - - # generate build cross-platform build files - generate: - name: Generate cross-platform builds - runs-on: ubuntu-latest - steps: - # step 1: checkout repository code inside the workspace directory of the runner - - name: Checkout the repository - uses: actions/checkout@v4 - # step 2: generate build files and dump inside the workspace directory of the runner - - name: Generate build files - uses: thatisuday/go-cross-build@v1 - with: - platforms: "linux/arm, linux/386, windows/386, darwin/amd64" - package: "wipechromium" - name: "wipechromium" - compress: "true" - dest: "distrib" - # step 3: Copy build-artifacts in the GitHub release - - name: Copy build-artifacts - uses: skx/github-action-publish-binaries@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Get OS and arch info + run: | + GOOSARCH=${{matrix.goosarch}} + GOOS=${GOOSARCH%/*} + GOARCH=${GOOSARCH#*/} + BINARY_NAME=${{github.repository}}-$GOOS-$GOARCH + echo "BINARY_NAME=$BINARY_NAME" >> $GITHUB_ENV + echo "GOOS=$GOOS" >> $GITHUB_ENV + echo "GOARCH=$GOARCH" >> $GITHUB_ENV + - name: Build + run: | + go build -o "$BINARY_NAME" -v + - name: Release Notes + run: + git log $(git describe HEAD~ --tags --abbrev=0)..HEAD --pretty='format:* %h %s%n * %an <%ae>' --no-merges >> ".github/RELEASE-TEMPLATE.md" + - name: Release with Notes + uses: softprops/action-gh-release@v2 with: - args: "./dist/*.tar.gz" + body_path: ".github/RELEASE-TEMPLATE.md" + draft: true + files: ${{env.BINARY_NAME}}