Skip to content

fix: release gh actiono #1

fix: release gh actiono

fix: release gh actiono #1

Workflow file for this run

name: release
on:
push:
branches: [prod]
jobs:
build:
name: Build
strategy:
matrix:
go-version: [1.19.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Build
run: |
export GOOS=${{ runner.os }}
if [ "$GOOS" = "linux" ]; then
export BINARY_NAME=ypd
export ARCHIVE_NAME=ypd.tar.gz
elif [ "$GOOS" = "windows" ]; then
export BINARY_NAME=ypd.exe
elif [ "$GOOS" = "darwin" ]; then
export BINARY_NAME=ypd
export ARCHIVE_NAME=ypd.dmg
fi
go build -o $BINARY_NAME
if [ -n "$ARCHIVE_NAME" ]; then
tar -czf $ARCHIVE_NAME $BINARY_NAME
fi
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ env.BINARY_NAME }}
asset_name: ${{ env.BINARY_NAME }}
asset_content_type: application/octet-stream
- name: Upload Archive Asset
if: env.ARCHIVE_NAME != 'ypd'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ env.ARCHIVE_NAME }}
asset_name: ${{ env.ARCHIVE_NAME }}
asset_content_type: application/gzip