Publish release by @Integral-Tech #4
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
name: Publish Release | |
run-name: Publish release ${{ inputs.tag }} by @${{ github.actor }} | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
tag: | |
type: string | |
required: true | |
jobs: | |
build: | |
strategy: | |
matrix: | |
goos: [ linux ] | |
goarch: [ arm64, 386, riscv64, mips64, mips64le, mipsle, mips ] | |
include: | |
# BEGIN Linux ARMv9 | |
- goos: linux | |
goarch: arm64 | |
goarm64: v9.0 | |
# END Linux ARMv9 | |
# BEGIN Linux ARM 5 6 7 | |
- goos: linux | |
goarch: arm | |
goarm: 7 | |
- goos: linux | |
goarch: arm | |
goarm: 6 | |
- goos: linux | |
goarch: arm | |
goarm: 5 | |
# END Linux ARM 5 6 7 | |
# BEGIN Linux AMD64 v1 v2 v3 | |
- goos: linux | |
goarch: amd64 | |
goamd64: v1 | |
- goos: linux | |
goarch: amd64 | |
goamd64: v2 | |
- goos: linux | |
goarch: amd64 | |
goamd64: v3 | |
# END Linux AMD64 v1 v2 v3 | |
fail-fast: false | |
runs-on: ubuntu-22.04 | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
GOARM: ${{ matrix.goarm }} | |
GOARM64: ${{ matrix.goarm64 }} | |
GOAMD64: ${{ matrix.goamd64 }} | |
CGO_ENABLED: 0 | |
steps: | |
- name: Checkout codebase | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ inputs.tag }} | |
- name: Get the version | |
id: get_version | |
env: | |
REF: ${{ inputs.tag }} | |
run: | | |
version=${REF} | |
echo "VERSION=$version" >> $GITHUB_OUTPUT | |
echo "VERSION=$version" >> $GITHUB_ENV | |
- name: Show workflow information | |
id: get_filename | |
run: | | |
export _NAME=$(jq ".[\"$GOOS-$GOARCH$GOARM$GOAMD64\"].friendlyName" -r < install/friendly-filenames.json) | |
echo "GOOS: $GOOS, GOARCH: $GOARCH, RELEASE_NAME: $_NAME" | |
echo "ASSET_NAME=$_NAME" >> $GITHUB_OUTPUT | |
echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
cache-dependency-path: | | |
go.mod | |
go.sum | |
go-version: '^1.22' | |
- name: Install Dependencies | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y clang-15 llvm-15 | |
- name: Get project dependencies | |
run: | | |
git submodule update --init --recursive | |
GOMODCACHE="${PWD}"/go-mod go mod download -modcacherw | |
find ./go-mod/ -maxdepth 1 ! -name "cache" ! -name "go-mod" -exec rm -rf {} \; | |
sed -i 's/#export GOMODCACHE=$(PWD)\/go-mod/export GOMODCACHE=$(PWD)\/go-mod/' Makefile | |
- name: Create full source ZIP archive and Signature | |
if: matrix.goarch == 'arm64' | |
run: | | |
zip -9vr dae-full-src.zip . -x .git/\* | |
FILE=./dae-full-src.zip | |
echo "$(md5sum $FILE)"" md5" >> $FILE.dgst | |
echo "$(shasum -a 1 $FILE)"" sha1" >> $FILE.dgst | |
echo "$(shasum -a 256 $FILE)"" sha256" >> $FILE.dgst | |
echo "$(shasum -a 512 $FILE)"" sha512" >> $FILE.dgst | |
- name: Build dae | |
run: | | |
mkdir -p ./build/ | |
export CGO_ENABLED=0 | |
export GOFLAGS="-trimpath -modcacherw" | |
export OUTPUT=build/dae-$ASSET_NAME | |
export VERSION=${{ steps.get_version.outputs.VERSION }} | |
export CLANG=clang-15 | |
export STRIP=llvm-strip-15 | |
make | |
cp ./install/dae.service ./build/ | |
cp ./example.dae ./build/ | |
curl -L -o ./build/geoip.dat https://github.com/v2fly/geoip/releases/latest/download/geoip.dat | |
curl -L -o ./build/geosite.dat https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat | |
- name: Smoking test | |
if: matrix.goarch == 'amd64' && matrix.goamd64 == 'v1' | |
run: ./build/dae-$ASSET_NAME --version | |
- name: Create binary ZIP archive and Signature | |
run: | | |
pushd build || exit 1 | |
zip -9vr ../dae-$ASSET_NAME.zip . | |
popd || exit 1 | |
FILE=./dae-$ASSET_NAME.zip | |
echo "$(md5sum $FILE)"" md5" >> $FILE.dgst | |
echo "$(shasum -a 1 $FILE)"" sha1" >> $FILE.dgst | |
echo "$(shasum -a 256 $FILE)"" sha256" >> $FILE.dgst | |
echo "$(shasum -a 512 $FILE)"" sha512" >> $FILE.dgst | |
- name: Upload files to Artifacts | |
uses: nanoufo/action-upload-artifacts-and-release-assets@v2 | |
with: | |
if-no-files-found: ignore | |
path: | | |
dae-${{ steps.get_filename.outputs.ASSET_NAME }}.zip | |
dae-${{ steps.get_filename.outputs.ASSET_NAME }}.zip.dgst | |
dae-full-src.zip | |
dae-full-src.zip.dgst | |
upload-release: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4.1.4 | |
with: | |
path: release/ | |
- name: Prepare files for upload | |
run: | | |
cp release/*/*.zip ./ | |
cp release/*/*.zip.dgst ./ | |
echo "Show files are going to upload..." | |
ls -lh | grep ".zip" | |
- name: Upload full source and artifacts to GitHub release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ inputs.tag }} | |
files: | | |
*zip | |
*dgst |