v0.2.2 #6
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
# This workflow will build a golang project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
name: Publish release assets | |
on: | |
release: | |
types: ['published'] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
# write permission is required to create a github release | |
contents: write | |
deployments: write | |
steps: | |
########################## | |
# Start deployment # | |
########################## | |
- name: start deployment | |
uses: bobheadxi/deployments@v1 | |
id: deployment | |
with: | |
step: start | |
token: ${{ secrets.GITHUB_TOKEN }} | |
env: release | |
desc: "release name: ${{ github.event.release.name }}, ref_id: ${{ github.head_ref }}" | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 'stable' | |
- name: Mod tidy | |
run: go mod tidy | |
- name: Linux build | |
run: | | |
go build -o /tmp/${{ github.event.repository.name }} ./cmd/${{ github.event.repository.name }}/ | |
cd /tmp | |
tar -czf ${{ github.event.repository.name }}-linux-${{ github.event.release.tag_name }}.tar.gz ./${{ github.event.repository.name }} | |
rm ./${{ github.event.repository.name }} | |
- name: Windows build | |
run: | | |
GOOS=windows GOARCH=amd64 go build -o /tmp/${{ github.event.repository.name }}.exe ./cmd/${{ github.event.repository.name }}/ | |
cd /tmp | |
zip ${{ github.event.repository.name }}-windows-${{ github.event.release.tag_name }}.zip ./${{ github.event.repository.name }}.exe | |
rm ./${{ github.event.repository.name }}.exe | |
- name: Darwin build | |
run: | | |
GOOS=darwin GOARCH=amd64 go build -o /tmp/${{ github.event.repository.name }} ./cmd/${{ github.event.repository.name }}/ | |
cd /tmp | |
tar -czf ${{ github.event.repository.name }}-darwin-${{ github.event.release.tag_name }}.tar.gz ./${{ github.event.repository.name }} | |
rm ./${{ github.event.repository.name }} | |
- name: Upload release assets | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
/tmp/${{ github.event.repository.name }}-darwin-${{ github.event.release.tag_name }}.tar.gz | |
/tmp/${{ github.event.repository.name }}-linux-${{ github.event.release.tag_name }}.tar.gz | |
/tmp/${{ github.event.repository.name }}-windows-${{ github.event.release.tag_name }}.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload linux artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ github.event.repository.name }}-linux-${{ github.event.release.tag_name }}.tar.gz | |
path: /tmp/${{ github.event.repository.name }}-linux-${{ github.event.release.tag_name }}.tar.gz | |
- name: Upload windows artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ github.event.repository.name }}-windows-${{ github.event.release.tag_name }}.zip | |
path: /tmp/${{ github.event.repository.name }}-windows-${{ github.event.release.tag_name }}.tar.gz | |
########################## | |
# Stop deployment # | |
########################## | |
- name: update deployment status | |
uses: bobheadxi/deployments@v1 | |
if: always() | |
with: | |
step: finish | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: ${{ job.status }} | |
env: ${{ steps.deployment.outputs.env }} | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | |