fix: use native build
This commit is contained in:
parent
7ec91b5b5e
commit
7d71f66080
46
.github/workflows/release.yaml
vendored
46
.github/workflows/release.yaml
vendored
|
@ -13,22 +13,48 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: sudo apt-get install build-essential
|
run: |
|
||||||
|
sudo apt-get install build-essential wget zip && \
|
||||||
|
wget https://golang.org/dl/go1.17.1.linux-amd64.tar.gz && \
|
||||||
|
sudo tar -C /usr/local -xzf go1.17.1.linux-amd64.tar.gz && \
|
||||||
|
echo PATH=$PATH:/usr/local/go/bin >> ~/.bashrc && \
|
||||||
|
source ~/.bashrc && \
|
||||||
|
export PATH=$PATH:/usr/local/go/bin && \
|
||||||
|
wget --no-check-certificate --progress=dot:mega https://github.com/wangyoucao577/assets-uploader/releases/download/v0.3.0/github-assets-uploader-v0.3.0-linux-amd64.tar.gz -O github-assets-uploader.tar.gz && \
|
||||||
|
tar -zxf github-assets-uploader.tar.gz && \
|
||||||
|
mv github-assets-uploader /usr/sbin/ && \
|
||||||
|
rm -f github-assets-uploader.tar.gz && \
|
||||||
|
github-assets-uploader -version
|
||||||
|
- name: Print Go Version
|
||||||
|
run: go version
|
||||||
- name: Install windows dependencies
|
- name: Install windows dependencies
|
||||||
if: ${{ matrix.goos == 'windows'}}
|
if: ${{ matrix.goos == 'windows'}}
|
||||||
run: sudo apt-get install gcc-mingw-w64
|
run: sudo apt-get install gcc-mingw-w64
|
||||||
- name: Set VERSION env
|
- name: Set VERSION env
|
||||||
run: echo VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV}
|
run: echo VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV}
|
||||||
- name: Set GO_ENABLED env
|
- name: Echo Version
|
||||||
|
run: echo ${VERSION}
|
||||||
|
- name: Set CGO_ENABLED env
|
||||||
run: echo CGO_ENABLED=1 >> ${GITHUB_ENV}
|
run: echo CGO_ENABLED=1 >> ${GITHUB_ENV}
|
||||||
|
- name: Set GOOS env
|
||||||
|
env: GOOS=${{matrix.goos}}
|
||||||
- name: Set Windows C Compiler GO env
|
- name: Set Windows C Compiler GO env
|
||||||
if: ${{ matrix.goos == 'windows'}}
|
if: ${{ matrix.goos == 'windows'}}
|
||||||
run: echo CC=/usr/bin/x86_64-w64-mingw32-gcc >> ${GITHUB_ENV}
|
run: echo CC=/usr/bin/x86_64-w64-mingw32-gcc >> ${GITHUB_ENV}
|
||||||
- uses: wangyoucao577/go-release-action@v1.20
|
- name: Create build
|
||||||
with:
|
run: make clean && make build
|
||||||
github_token: ${{ secrets.RELEASE_TOKEN }}
|
- name: Package files
|
||||||
goos: ${{ matrix.goos }}
|
if: ${{ matrix.goos == 'windows'}}
|
||||||
goarch: ${{ matrix.goarch }}
|
run: |
|
||||||
build_command: make clean && make
|
mv .env.sample .env && \
|
||||||
md5sum: FALSE
|
zip -vr authorizer-${VERSION}-windows-${matrix.goarch}.zip .env app build template && \
|
||||||
extra_files: .env.sample app build template
|
github-assets-uploader -f authorizer-${VERSION}-windows-${matrix.goarch}.zip -mediatype application/zip -repo authorizerdev/authorizer -token ${secrets.RELEASE_TOKEN} -tag ${VERSION}
|
||||||
|
|
||||||
|
# - uses: wangyoucao577/go-release-action@v1.20
|
||||||
|
# with:
|
||||||
|
# github_token: ${{ secrets.RELEASE_TOKEN }}
|
||||||
|
# goos: ${{ matrix.goos }}
|
||||||
|
# goarch: ${{ matrix.goarch }}
|
||||||
|
# build_command: make clean && make
|
||||||
|
# md5sum: FALSE
|
||||||
|
# extra_files: .env.sample app build template
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -2,6 +2,6 @@ DEFAULT_VERSION=0.1.0-local
|
||||||
VERSION := $(or $(VERSION),$(DEFAULT_VERSION))
|
VERSION := $(or $(VERSION),$(DEFAULT_VERSION))
|
||||||
|
|
||||||
cmd:
|
cmd:
|
||||||
cd server && go build -ldflags "-w -X main.Version=$(VERSION)" -o '../build/server'
|
cd server && CGO_ENABLED=1 GOOS=$(GOOS) CC=$(CC) go build -ldflags "-w -X main.Version=$(VERSION)" -o '../build/server'
|
||||||
clean:
|
clean:
|
||||||
rm -rf build
|
rm -rf build
|
Loading…
Reference in New Issue
Block a user