Skip to content

add decrypt file function #11

add decrypt file function

add decrypt file function #11

name: Go Build and Release
on:
push:
branches: [ main ]
paths-ignore:
- 'docs/**'
- '.github/**'
- 'configs/**'
- '**.md'
- 'LICENSE'
pull_request:
branches: [ main ]
paths-ignore:
- 'docs/**'
- '.github/**'
- 'configs/**'
- '**.md'
- 'LICENSE'
workflow_dispatch:
inputs:
version:
description: 'version'
required: false
default: 'latest'
# use ${{ github.event.inputs.version }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup golang
uses: actions/setup-go@v4
with:
go-version: '^1.20'
- name: Build
run: |
# 下载依赖
git clone https://github.com/gek64/gek.git
ln -s ${{ github.workspace }}/gek ../gek
mkdir -p bin
# 编译批量编译程序
git clone https://github.com/gek64/gobuilder.git
cd gobuilder
go mod tidy
go build -v -trimpath -ldflags "-s -w" -o "${{ github.workspace }}/gobuilder_runner"
chmod +x "${{ github.workspace }}/gobuilder_runner"
cd ${{ github.workspace }}
# 获取版本信息
echo "$(go run . -v)" > bin/version.txt
# 编译所有支持的架构/系统对
go mod tidy
"${{ github.workspace }}/gobuilder_runner" -main -d bin
# 编译 mipsle softfloat 版本
GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -v -trimpath -ldflags "-s -w" -o bin/build-linux-mipsle-softfloat
# 显示文件路径(debug)
# ls .. -R -las
# 获取sha256 checksum
sha256sum bin/* > bin/SHA256SUMS.txt
- name: Remove old Releases
uses: dev-drprasad/delete-older-releases@v0.3.2
with:
keep_latest: 0
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: build_files
path: bin/*
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
name: build_files
path: bin
- name: Read version
run: |
# 获取版本信息
echo "VERSION=$(cat bin/version.txt)" >> $GITHUB_ENV
rm -rf bin/version.txt
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: "bin/*"
tag: ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
delete-artifacts:
runs-on: ubuntu-latest
needs: release
steps:
- name: Remove old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
age: "0s"