1
1
mirror of https://github.com/ssut/payload-dumper-go.git synced 2024-11-18 01:27:39 +00:00
payload-dumper-go/.github/workflows/goreleaser.yml
2024-11-17 00:44:09 +09:00

146 lines
5.0 KiB
YAML

name: goreleaser
on:
push:
tags:
- "*"
jobs:
macos-sdk:
runs-on: macos-latest
steps:
- id: osxcross-macos-sdk
uses: actions/cache@v2
with:
path: osxcross/tarballs
key: ${{ runner.os }}-osxcross-macos-sdk
- name: Package MacOSX SDK
if: steps.osxcross-macos-sdk.outputs.cache-hit != 'true'
run: |
git clone https://github.com/tpoechtrager/osxcross osxcross
pushd osxcross
XCODEDIR=/Applications/Xcode_16.0.app tools/gen_sdk_package.sh
mv MacOSX*.sdk.tar.xz tarballs/
popd
- uses: actions/upload-artifact@master
with:
name: osxcross-tarballs
path: osxcross/tarballs
goreleaser:
runs-on: ubuntu-latest
container: fedora:34
needs: macos-sdk
steps:
- name: Install dependencies
run: |
dnf -y install autoconf bash clang cmake gettext-devel git glibc-{devel,static}.{i686,x86_64} golang libstdc++-static libtool libuuid-devel libxml2-devel llvm-devel make mingw{32,64}-{winpthreads,xz-libs}-static mingw{32,64}-gcc{-c++,} openssl-devel patch po4a xz-{devel,static}.{i686,x86_64}
dnf -y install 'dnf-command(download)'
dnf download --source xz-devel
rpm -ivh *.src.rpm
rm -f *.src.rpm
- name: Setup cross compile environment for Linux ARMv7
env:
CC: arm-linux-gnueabihf-gcc
CXX: arm-linux-gnueabihf-c++
CFLAGS: -fPIC
run: |
dnf -y copr enable lantw44/arm-linux-gnueabihf-toolchain
dnf -y install arm-linux-gnueabihf-{binutils,gcc,glibc}
mkdir /linux-armv7-buildroot
pushd /linux-armv7-buildroot
tar -xvf $HOME/rpmbuild/SOURCES/xz-*.tar.xz
pushd $(basename $HOME/rpmbuild/SOURCES/xz-*.tar.xz .tar.xz)
./autogen.sh
./configure --host=armv7 --prefix=/linux-armv7-buildroot/sys-root
make -j$(nproc) install
popd
popd
- name: Setup cross compile environment for Linux AArch64
env:
CC: aarch64-linux-gnu-gcc
CXX: aarch64-linux-gnu-c++
run: |
dnf -y copr enable lantw44/aarch64-linux-gnu-toolchain
dnf -y install aarch64-linux-gnu-{binutils,gcc,glibc}
mkdir /linux-aarch64-buildroot
pushd /linux-aarch64-buildroot
tar -xvf $HOME/rpmbuild/SOURCES/xz-*.tar.xz
pushd $(basename $HOME/rpmbuild/SOURCES/xz-*.tar.xz .tar.xz)
./autogen.sh
./configure --host=aarch64 --prefix=/linux-aarch64-buildroot/sys-root
make -j$(nproc) install
popd
popd
- name: Download osxcross
run: git clone https://github.com/tpoechtrager/osxcross /osxcross
- id: osxcross-target
uses: actions/cache@v2
with:
path: /osxcross/target
key: ${{ runner.os }}-osxcross-target
- uses: actions/download-artifact@master
if: steps.osxcross-target.outputs.cache-hit != 'true'
with:
name: osxcross-tarballs
path: /osxcross/tarballs
- uses: geekyeggo/delete-artifact@v1
with:
name: osxcross-tarballs
- name: Build osxcross
if: steps.osxcross-target.outputs.cache-hit != 'true'
run: UNATTENDED=1 SDK_VERSION=15.0 ./build.sh
working-directory: /osxcross
- name: Setup cross compile environment for Darwin AMD64
env:
CC: o64-clang
CXX: o64-clang++
run: |
mkdir /darwin-amd64-buildroot
pushd /darwin-amd64-buildroot
tar -xvf $HOME/rpmbuild/SOURCES/xz-*.tar.xz
pushd $(basename $HOME/rpmbuild/SOURCES/xz-*.tar.xz .tar.xz)
PATH=/osxcross/target/bin:$PATH ./autogen.sh
PATH=/osxcross/target/bin:$PATH ./configure --host=x86_64-apple-darwin20.2 --prefix=/darwin-amd64-buildroot/sys-root --enable-shared=no
PATH=/osxcross/target/bin:$PATH make -j$(nproc) install
popd
popd
- name: Setup cross compile environment for Darwin AArch64
env:
CC: oa64-clang
CXX: oa64-clang++
run: |
mkdir /darwin-aarch64-buildroot
pushd /darwin-aarch64-buildroot
tar -xvf $HOME/rpmbuild/SOURCES/xz-*.tar.xz
pushd $(basename $HOME/rpmbuild/SOURCES/xz-*.tar.xz .tar.xz)
PATH=/osxcross/target/bin:$PATH ./autogen.sh
PATH=/osxcross/target/bin:$PATH ./configure --host=aarch64-apple-darwin20.2 --prefix=/darwin-aarch64-buildroot/sys-root --enable-shared=no
PATH=/osxcross/target/bin:$PATH make -j$(nproc) install
popd
popd
- uses: actions/checkout@v2
- name: Add $GITHUB_WORKSPACE to git safe.directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"