Skip to content

修改readme

修改readme #25

Workflow file for this run

name: release
on:
push:
tags:
- '*'
jobs:
release:
strategy:
matrix:
platform: [ ubuntu-latest ]
go-version: [1.22.1 ]
name: Build
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Get Set
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "app_name=enscan-${{steps.get_version.outputs.VERSION}}" >> $GITHUB_ENV
builtAt=$(date +'%F %T %z')
goVersion=$(go version | sed 's/go version //')
gitAuthor=${{ github.actor }}
buildSha=${{ github.sha }}
gitTag=${{steps.get_version.outputs.VERSION}}
echo 'ldflags<<EOF' >> $GITHUB_ENV
echo "-w -s" >>$GITHUB_ENV
echo "-X 'github.com/wgpsec/ENScan/common.BuiltAt=$builtAt' ">>$GITHUB_ENV
echo "-X 'github.com/wgpsec/ENScan/common.GoVersion=$goVersion' ">>$GITHUB_ENV
echo "-X 'github.com/wgpsec/ENScan/common.GitAuthor=$gitAuthor' ">>$GITHUB_ENV
echo "-X 'github.com/wgpsec/ENScan/common.BuildSha=$buildSha' ">>$GITHUB_ENV
echo " -X 'github.com/wgpsec/ENScan/common.GitTag=$gitTag' ">>$GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
sudo apt-get update
sudo apt-get -y install gcc-mingw-w64-x86-64
sudo apt-get -y install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
sudo apt-get -y install gcc-aarch64-linux-gnu libc6-dev-arm64-cross
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build linux
run: |
CC=gcc CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="${{env.ldflags}}" -o ${{env.app_name}}-linux-amd64 enscan.go
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags="${{env.ldflags}}" -o ${{env.app_name}}-linux-arm64 enscan.go
CC=arm-linux-gnueabihf-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm go build -ldflags="${{env.ldflags}}" -o ${{env.app_name}}-linux-arm enscan.go
- name: Build windows
run: |
CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -ldflags="${{env.ldflags}}" -o ${{env.app_name}}-windows-amd64.exe enscan.go
- name: Build linux_386
run: |
sudo apt-get -y install libc6-dev-i386
CC=gcc CGO_ENABLED=1 GOOS=linux GOARCH=386 go build -ldflags="${{env.ldflags}}" -o ${{env.app_name}}-linux-386 enscan.go
- name: Build darwin
run: |
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="${{env.ldflags}}" -gcflags '-N -l' -o ${{env.app_name}}-darwin-amd64 enscan.go
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="${{env.ldflags}}" -gcflags '-N -l' -o ${{env.app_name}}-darwin-arm64 enscan.go
- name: compress
run: |
mkdir "build"
mv ${{env.app_name}}-* build
cd build || exit
find . -type f -print0 | xargs -0 md5sum > md5.txt
cat md5.txt
mkdir compress
mv md5.txt compress
for i in `find . -type f -name "${{env.app_name}}-linux-*"`
do
tar -czvf compress/"$i".tar.gz "$i"
done
for i in `find . -type f -name "${{env.app_name}}-darwin-*"`
do
tar -czvf compress/"$i".tar.gz "$i"
done
for i in `find . -type f -name "${{env.app_name}}-windows-*"`
do
zip compress/$(echo $i | sed 's/\.[^.]*$//').zip "$i"
done
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- 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 }}
body: ${{steps.github_release.outputs.changelog}}
draft: false
prerelease: false
- name: Release
uses: softprops/action-gh-release@v1
with:
files: build/compress/*