Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Actions Workflow for Building and Releasing Binaries with Checksums #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/release_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Release Build

on:
release:
types:
- published

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-24.04
strategy:
matrix:
goarch: [amd64, arm64]
goos: [darwin, linux, windows]
type: [server, client]
steps:
- uses: actions/checkout@v4

- name: Define extension file name for windows
run: |
if [ "${{ matrix.goos }}" = "windows" ]; then
echo "BIN_EXT=.exe" >> $GITHUB_ENV
else
echo "BIN_EXT=" >> $GITHUB_ENV
fi

- name: Define file name
run: |
echo "FILE_NAME=darkflare-${{ matrix.type }}-${{ matrix.goos }}-${{ matrix.goarch }}${{ env.BIN_EXT }}" >> $GITHUB_ENV

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23.3'

- name: Download Go dependencies
run: go mod tidy

- name: Build for ${{ matrix.type }} ${{ matrix.goarch }} ${{ matrix.goos }}
run: GOARCH=${{ matrix.goarch }} GOOS=${{ matrix.goos }} go build -o ${{ env.FILE_NAME }} ${{ matrix.type }}/main.go

- name: Generate checksum
run: sha256sum ${{ env.FILE_NAME }} >> checksum-${{ env.FILE_NAME }}

- name: Upload checksum artifact
uses: actions/upload-artifact@v4
with:
name: checksum-${{ env.FILE_NAME }}
path: checksum-${{ env.FILE_NAME }}
retention-days: 1

- name: Upload binary to release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ env.FILE_NAME }}

upload-checksums:
runs-on: ubuntu-24.04
needs: build
steps:
- uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v4

- name: Generate checksum file
run: cat checksum-*/* > checksums.txt

- name: Upload checksum file to release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: checksums.txt
14 changes: 0 additions & 14 deletions bin/checksums.txt

This file was deleted.

Binary file removed bin/darkflare-client-darwin-amd64
Binary file not shown.
Binary file removed bin/darkflare-client-darwin-arm64
Binary file not shown.
Binary file removed bin/darkflare-client-linux-amd64
Binary file not shown.
Binary file removed bin/darkflare-client-linux-arm64
Binary file not shown.
Binary file removed bin/darkflare-client-windows-amd64.exe
Binary file not shown.
Binary file removed bin/darkflare-server-darwin-amd64
Binary file not shown.
Binary file removed bin/darkflare-server-darwin-arm64
Binary file not shown.
Binary file removed bin/darkflare-server-linux-amd64
Binary file not shown.
Binary file removed bin/darkflare-server-linux-arm64
Binary file not shown.
Binary file removed bin/darkflare-server-windows-amd64.exe
Binary file not shown.