use msys2 to build windows binaries #376
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-zbox | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
- staging | |
tags: | |
- 'v*.*.*' | |
pull_request: | |
jobs: | |
# build-linux: | |
# name: Build-linux | |
# runs-on: [self-hosted, build] | |
# steps: | |
# - name: Install deps | |
# run: | | |
# sudo apt update | |
# sudo apt -y install build-essential nghttp2 libnghttp2-dev libssl-dev containerd docker.io | |
# - name: Checkout | |
# uses: actions/checkout@v2 | |
# - name: Setup go 1.20 | |
# uses: actions/setup-go@v2 | |
# with: | |
# go-version: '1.20' # The Go version to download (if necessary) and use. | |
# - name: Set GITHUB_ENV | |
# run: | | |
# echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV | |
# if [[ "${{github.base_ref}}" == "master" || "${{github.ref}}" == "refs/heads/master" ]]; then | |
# echo "TAG=v0.0.0-master" >> $GITHUB_ENV | |
# elif [[ "${{github.base_ref}}" == "dev" || "${{github.ref}}" == "refs/heads/dev" ]]; then | |
# echo "TAG=v0.0.0-dev" >> $GITHUB_ENV | |
# elif [[ "${{github.base_ref}}" == "staging" || "${{github.ref}}" == "refs/heads/staging" ]]; then | |
# echo "TAG=v0.0.0-staging" >> $GITHUB_ENV | |
# else | |
# echo "TAG=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV | |
# fi | |
# - name: Install | |
# run: make install | |
# - name: Zip release | |
# run: tar -czvf zbox-linux.tar.gz ./zbox | |
# - name: Upload binaries to release | |
# uses: svenstaro/upload-release-action@v2 | |
# with: | |
# repo_token: ${{ secrets.GITHUB_TOKEN }} | |
# file: zbox-linux.tar.gz | |
# tag: ${{ env.TAG }} | |
# overwrite: true | |
# file_glob: true | |
# - name: 'Upload Artifact' | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: zbox-linux | |
# path: zbox | |
# retention-days: 5 | |
build-windows: | |
name: Build-windows | |
runs-on: windows-runner | |
steps: | |
- name: Setup go 1.20 | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.20' # The Go version to download (if necessary) and use. | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set GITHUB_ENV | |
run: | | |
echo $Env:GITHUB_REF | |
echo $Env:GITHUB_BASE_REF | |
if ($Env:GITHUB_BASE_REF -eq "master" -or $Env:GITHUB_REF -eq "refs/heads/master") { | |
"TAG=v0.0.0-master" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
} elseif ($Env:GITHUB_BASE_REF -eq "dev" -or $Env:GITHUB_REF -eq "refs/heads/dev") { | |
"TAG=v0.0.0-dev" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
} elseif ($Env:GITHUB_BASE_REF -eq "staging" -or $Env:GITHUB_REF -eq "refs/heads/staging") { | |
"TAG=v0.0.0-staging" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
} else { | |
$Env:GITHUB_REF -replace 'refs/tags/', 'TAG=' | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
} | |
- name: Install | |
run: make install | |
- name: Zip release | |
run: | | |
copy zbox zbox.exe | |
7z a zbox-windows.zip zbox.exe | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: zbox-windows.zip | |
tag: ${{ env.TAG }} | |
overwrite: true | |
file_glob: true | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: zbox-windows | |
path: zbox | |
retention-days: 5 | |
# build-macos: | |
# name: Build-macos | |
# runs-on: macos-runner | |
# steps: | |
# - name: Setup go 1.20 | |
# uses: actions/setup-go@v2 | |
# with: | |
# go-version: '1.20' # The Go version to download (if necessary) and use. | |
# - name: Checkout | |
# uses: actions/checkout@v2 | |
# - name: Set GITHUB_ENV | |
# run: | | |
# echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV | |
# if [[ "${{github.base_ref}}" == "master" || "${{github.ref}}" == "refs/heads/master" ]]; then | |
# echo "TAG=v0.0.0-master" >> $GITHUB_ENV | |
# elif [[ "${{github.base_ref}}" == "dev" || "${{github.ref}}" == "refs/heads/dev" ]]; then | |
# echo "TAG=v0.0.0-dev" >> $GITHUB_ENV | |
# elif [[ "${{github.base_ref}}" == "staging" || "${{github.ref}}" == "refs/heads/staging" ]]; then | |
# echo "TAG=v0.0.0-dev" >> $GITHUB_ENV | |
# else | |
# echo "TAG=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV | |
# fi | |
# - name: Install | |
# run: make install | |
# - name: Zip release | |
# run: tar -czvf zbox-macos.tar.gz ./zbox | |
# - name: Upload binaries to release | |
# uses: svenstaro/upload-release-action@v2 | |
# with: | |
# repo_token: ${{ secrets.GITHUB_TOKEN }} | |
# file: zbox-macos.tar.gz | |
# tag: ${{ env.TAG }} | |
# overwrite: true | |
# file_glob: true | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: zbox-macos | |
path: zbox | |
retention-days: 5 |