Skip to content

Commit

Permalink
Rewrite of crossbuild.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord of Scripts committed Aug 28, 2024
1 parent c52e46c commit 666fee7
Showing 1 changed file with 44 additions and 26 deletions.
70 changes: 44 additions & 26 deletions .github/workflows/crossbuild.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,66 @@
# From github.com/marketplace/actions/go-cross-build v1.0.2
# workflow name
name: crossbuild
name: Cross-build

# on events
on:
watch:
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

- name: Set up Go
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}}

0 comments on commit 666fee7

Please sign in to comment.