Skip to content

Commit

Permalink
Update release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
regisrex authored Apr 22, 2024
1 parent 8694009 commit d8fb769
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: release
name: Release

on:
release:
types: [created]
push:
branches: [prod]

jobs:

build:
name: Build
strategy:
Expand All @@ -26,21 +29,22 @@ jobs:
- name: Build
run: |
export GOOS=${{ runner.os }}
# if [ "$GOOS" = "" ]; then
# export BINARY_NAME=ypd
# export ARCHIVE_NAME=ypd.tar.gz
if [ "$GOOS" = "windows" ]; then
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
go build -o $BINARY_NAME
if [ -n "$ARCHIVE_NAME" ]; then
tar -czf $ARCHIVE_NAME $BINARY_NAME
tar -czf $ARCHIVE_NAME $BINARY_NAME
fi
- name: Upload Release Asset
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -51,7 +55,7 @@ jobs:
asset_content_type: application/octet-stream

- name: Upload Archive Asset
if: env.ARCHIVE_NAME != 'ypd'
if: github.event_name == 'release' && env.ARCHIVE_NAME != ''
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -60,3 +64,12 @@ jobs:
asset_path: ./${{ env.ARCHIVE_NAME }}
asset_name: ${{ env.ARCHIVE_NAME }}
asset_content_type: application/gzip

- name: Upload Artifacts
if: github.event_name == 'push'
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}
path: |
./${{ env.BINARY_NAME }}
./${{ env.ARCHIVE_NAME }}

0 comments on commit d8fb769

Please sign in to comment.