Cross compile for ARM
parent
e2e6dafee4
commit
a40b1576bb
|
@ -1,48 +0,0 @@
|
||||||
version: 2.1
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
machine:
|
|
||||||
image: ubuntu-2004:current
|
|
||||||
resource_class: arm.medium
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
|
|
||||||
- run: |
|
|
||||||
docker run -it --rm -v "$PWD":/work -w /work golang:1.20-bullseye bash -c 'CGO_ENABLED=0 go build -buildvcs=false -ldflags="-s -w"'
|
|
||||||
sudo mv go-vod go-vod-aarch64
|
|
||||||
|
|
||||||
- persist_to_workspace:
|
|
||||||
root: .
|
|
||||||
paths:
|
|
||||||
- go-vod-aarch64
|
|
||||||
|
|
||||||
publish-github-release:
|
|
||||||
docker:
|
|
||||||
- image: cimg/go:1.17
|
|
||||||
steps:
|
|
||||||
- attach_workspace:
|
|
||||||
at: ./artifacts
|
|
||||||
- run:
|
|
||||||
name: "Publish Release on GitHub"
|
|
||||||
command: |
|
|
||||||
go get github.com/tcnksm/ghr
|
|
||||||
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -replace ${CIRCLE_TAG} ./artifacts/
|
|
||||||
|
|
||||||
workflows:
|
|
||||||
aarch64:
|
|
||||||
jobs:
|
|
||||||
- build:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
ignore: /.*/
|
|
||||||
tags:
|
|
||||||
only: /^.*/
|
|
||||||
- publish-github-release:
|
|
||||||
requires:
|
|
||||||
- build
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
ignore: /.*/
|
|
||||||
tags:
|
|
||||||
only: /^.*/
|
|
|
@ -1,4 +1,4 @@
|
||||||
name: amd64
|
name: release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -6,8 +6,8 @@ on:
|
||||||
- "*"
|
- "*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-amd64:
|
build:
|
||||||
name: amd64
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
container:
|
container:
|
||||||
|
@ -18,13 +18,15 @@ jobs:
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: CGO_ENABLED=0 go build -buildvcs=false -ldflags="-s -w"
|
run: |
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -buildvcs=false -ldflags="-s -w" -o go-vod-amd64
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -buildvcs=false -ldflags="-s -w" -o go-vod-arm64
|
||||||
|
|
||||||
- name: Upload to releases
|
- name: Upload to releases
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
id: attach_to_release
|
id: attach_to_release
|
||||||
with:
|
with:
|
||||||
file: go-vod
|
file: go-vod-*
|
||||||
asset_name: go-vod-amd64
|
file_glob: true
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
overwrite: true
|
overwrite: true
|
Loading…
Reference in New Issue