name: Build and Package Golang on: push: branches: - master pull_request: branches: - master jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y debhelper dh-golang build-essential wget - name: Download Go Bootstrap run: | wget https://go.dev/dl/go1.21.1.linux-amd64.tar.gz tar -C /usr/local -xzf go1.21.1.linux-amd64.tar.gz mv /usr/local/go /usr/local/go-bootstrap - name: Compile Golang from source run: | export GOROOT_BOOTSTRAP=/usr/local/go-bootstrap cd src ./make.bash cd .. - name: Prepare .deb package structure run: | mkdir -p build/usr/local/go cp -r ./* build/usr/local/go/ # 创建 DEBIAN 目录并写入控制信息 mkdir -p build/DEBIAN cat < build/DEBIAN/control Package: golang Version: 1.22.6-1 Section: devel Priority: optional Architecture: amd64 Maintainer: Deepin Community Depends: libc6 (>= 2.17) Description: The Go programming language Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. EOF - name: Build .deb package run: | dpkg-deb --build build golang_1.22.6-1_amd64.deb - name: Upload artifact uses: actions/upload-artifact@v3 with: name: golang-package path: golang_1.22.6-1_amd64.deb