-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Build and Pre-release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
asset_paths: "dht-dce-windows-386,dht-dce-windows-amd64,dht-dce-linux-386,dht-dce-linux-amd64" | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.20.6 | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get dependencies | ||
run: go get -v -t -d ./... | ||
|
||
- name: Build windows-386 | ||
run: GOOS=windows GOARCH=386 go build -v -o dht-dce-windows-386.exe . | ||
|
||
- name: Build windows-amd64 | ||
run: GOOS=windows GOARCH=amd64 go build -v -o dht-dce-windows-amd64.exe . | ||
|
||
- name: Build linux-386 | ||
run: GOOS=linux GOARCH=386 go build -v -o dht-dce-linux-386 . | ||
|
||
- name: Build linux-amd64 | ||
run: GOOS=linux GOARCH=amd64 go build -v -o dht-dce-linux-amd64 . | ||
|
||
- name: Upload the artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build | ||
path: | | ||
dht-dce-windows-386.exe | ||
dht-dce-windows-amd64.exe | ||
dht-dce-linux-386 | ||
dht-dce-linux-amd64 | ||
upload: | ||
name: Upload release | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: github.ref == 'refs/heads/main' | ||
|
||
steps: | ||
- name: Delete old release and tag | ||
uses: dev-drprasad/[email protected] | ||
with: | ||
delete_release: true | ||
tag_name: latest_auto | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Get artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: build | ||
|
||
- name: Release to GitHub | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
name: Latest Autobuild | ||
tag: latest_auto | ||
commit: main | ||
body: ${{ github.event.head_commit.message }} | ||
artifacts: "build/dht-dce/dht-dce-windows-386.exe, build/dht-dce/dht-dce-windows-amd64.exe, build/dht-dce/dht-dce-linux-386, build/dht-dce/dht-dce-linux-amd64" | ||
prerelease: true |