Upload binary to release in action

This commit is contained in:
lucheng
2024-07-03 09:27:50 +08:00
parent c6b1414e0c
commit deb38c4e77
2 changed files with 36 additions and 4 deletions

View File

@@ -2,9 +2,8 @@ name: Build virtullan
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
tags:
- 'v*'
jobs:
build:
@@ -22,6 +21,39 @@ jobs:
- name: Install dependencies
run: go mod tidy
- name: Test
run: go test -v ./...
- name: Run build
run: make
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset linux
id: upload-release-asset-linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./virtuallan
asset_name: virtuallan
- name: Upload Release Asset windows
id: upload-release-asset-windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./virtuallan.exe
asset_name: virtuallan.exe

View File

@@ -1,4 +1,4 @@
.DEFAULT_GOAL := build
.DEFAULT_GOAL := build build-windows
IMG ?= virtuallan:latest
CONTAINER_TOOL ?= docker