Skip to content

more verbose output

more verbose output #2

name: Build and Release
on:
push:
branches:
- '*'
tags:
- 'v*'
env:
GITHUB_REF: ${{ github.ref }}
LINUX_AMD_ARCHIVE: sodium-${GITHUB_REF}-linux-amd64.tar.gz
LINUX_ARM_ARCHIVE: sodium-${GITHUB_REF}-linux-arm.tar.gz
WIN_AMD_ARCHIVE: sodium-${GITHUB_REF}-win-amd64.zip
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21.3
- name: Build Binaries
id: build
run: |
echo "Building Linux amd64 binary"
GOOS=linux GOARCH=amd64 go build -o na
tar -czvf ${LINUX_AMD_ARCHIVE} na
rm -v na
echo "Building Linux ARM binary"
GOOS=linux GOARCH=arm go build -o na
tar -czvf ${LINUX_ARM_ARCHIVE} na
rm -v na
echo "Building Windows amd64 binary"
GOOS=windows GOARCH=amd64 go build -o na.exe
zip ${WIN_AMD_ARCHIVE} na.exe
rm -v na.exe
ls -lah
- name: Upload binaries to artifacts (feature branch only)
if: contains(github.ref, 'refs/heads/')
uses: actions/upload-artifact@v2
with:
name: binaries
path: |
${LINUX_AMD_ARCHIVE}
${LINUX_ARM_ARCHIVE}
${WIN_AMD_ARCHIVE}
release:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download binaries from artifacts
uses: actions/download-artifact@v2
with:
name: binaries
- name: Create Release
id: create_release
uses: gh-actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Sodium ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Linux amd64 Archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${LINUX_AMD_ARCHIVE}
asset_name: ${LINUX_AMD_ARCHIVE}
asset_content_type: application/octet-stream
- name: Upload Linux ARM Archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${LINUX_ARM_ARCHIVE}
asset_name: ${LINUX_ARM_ARCHIVE}
asset_content_type: application/octet-stream
- name: Upload Windows amd64 Archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${WIN_AMD_ARCHIVE}
asset_name: ${WIN_AMD_ARCHIVE}
asset_content_type: application/octet-stream