Skip to content

Build

Build #64

Workflow file for this run

name: Build
on:
push:
paths-ignore:
- LICENSE
- "*.md"
- .vscode
- .devcontainer
branches:
- main
- dev
tags:
- latest
- v*.*.*
jobs:
# Include arm64 if ref is a tag
setup-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Set up matrix
id: set-matrix
run: |
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
echo "matrix=[\"ubuntu-latest\", \"arm64\"]" >> $GITHUB_OUTPUT
else
echo "matrix=[\"ubuntu-latest\"]" >> $GITHUB_OUTPUT
fi
tarball:
runs-on: ubuntu-latest
needs: [setup-matrix]
steps:
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Checkout GlobalProtect-openconnect
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PAT }}
repository: yuezk/GlobalProtect-openconnect
path: gp
- name: Create tarball
run: |
cd gp
make tarball
- name: Upload tarball
uses: actions/upload-artifact@v3
with:
name: artifact-tarball
if-no-files-found: error
path: |
gp/.build/tarball/*.tar.gz
build-deb:
needs:
- setup-matrix
- tarball
strategy:
matrix:
os: ${{fromJson(needs.setup-matrix.outputs.matrix)}}
runs-on: ${{ matrix.os }}
container:
image: yuezk/gpdev:main
credentials:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
steps:
- name: Download tarball
uses: actions/download-artifact@v3
with:
name: artifact-tarball
- name: Build DEB package
run: |
tar -xzf *.tar.gz
cd globalprotect-openconnect-*
make deb BUILD_FE=0
- name: Install DEB package
run: |
cd globalprotect-openconnect-*/
sudo dpkg -i .build/deb/*.deb
gpclient --version
gpservice --version
gpauth --version
gpgui-helper --version
- name: Upload DEB package
uses: actions/upload-artifact@v3
with:
name: artifact-deb-${{ matrix.os }}
if-no-files-found: error
path: |
globalprotect-openconnect-*/.build/deb/*.deb
build-rpm:
needs:
- setup-matrix
- tarball
strategy:
matrix:
os: ${{fromJson(needs.setup-matrix.outputs.matrix)}}
runs-on: ${{ matrix.os }}
container:
image: yuezk/gpdev:rpm-builder
credentials:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
steps:
- name: Download tarball
uses: actions/download-artifact@v3
with:
name: artifact-tarball
- name: Build RPM package
run: |
tar -xzf globalprotect-openconnect-*.tar.gz
cd globalprotect-openconnect-*/
make rpm BUILD_FE=0
- name: Install RPM package
run: |
cd globalprotect-openconnect-*/
ls -l .build/rpm
sudo rpm -i ".build/rpm/globalprotect-openconnect*.$(uname -m).rpm"
gpclient --version
gpservice --version
gpauth --version
gpgui-helper --version
- name: Upload RPM package
uses: actions/upload-artifact@v3
with:
name: artifact-rpm-${{ matrix.os }}
if-no-files-found: error
path: |
globalprotect-openconnect-*/.build/rpm/*.rpm
build-pkgbuild:
needs:
- setup-matrix
- tarball
strategy:
matrix:
os: ${{fromJson(needs.setup-matrix.outputs.matrix)}}
runs-on: ${{ matrix.os }}
container:
image: yuezk/gpdev:pkgbuild
credentials:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
steps:
- name: Download tarball
uses: actions/download-artifact@v3
with:
name: artifact-tarball
- name: Build PKGBUILD package
run: |
tar -xzf globalprotect-openconnect-*.tar.gz
cd globalprotect-openconnect-*/
make pkgbuild BUILD_FE=0
- name: Install PKGBUILD package
run: |
cd globalprotect-openconnect-*/
sudo pacman -U --noconfirm .build/pkgbuild/*.pkg.tar.zst
gpclient --version
gpservice --version
gpauth --version
gpgui-helper --version
- name: Upload PKGBUILD package
uses: actions/upload-artifact@v3
with:
name: artifact-pkgbuild-${{ matrix.os }}
if-no-files-found: error
path: |
globalprotect-openconnect-*/.build/pkgbuild/*.pkg.tar.zst
build-binary:
needs:
- setup-matrix
- tarball
strategy:
matrix:
os: ${{fromJson(needs.setup-matrix.outputs.matrix)}}
runs-on: ${{ matrix.os }}
container:
image: yuezk/gpdev:main
credentials:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
steps:
- name: Download tarball
uses: actions/download-artifact@v3
with:
name: artifact-tarball
- name: Build binary using OFFLINE mode
run: |
tar -xzf globalprotect-openconnect-*.tar.gz
cd globalprotect-openconnect-*/
make binary OFFLINE=1
- name: Install binary
run: |
cd globalprotect-openconnect-*/
cd .build/binary/globalprotect-openconnect_*_$(uname -m)
sudo make install
gpclient --version
gpservice --version
gpauth --version
gpgui-helper --version
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: artifact-binary-${{ matrix.os }}
if-no-files-found: error
path: |
globalprotect-openconnect-*/.build/binary/*.bin.tar.xz*
build-gpgui:
needs:
- setup-matrix
strategy:
matrix:
os: ${{fromJson(needs.setup-matrix.outputs.matrix)}}
runs-on: ${{ matrix.os }}
container:
image: yuezk/gpdev:main
credentials:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
steps:
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Checkout GlobalProtect-openconnect
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PAT }}
repository: yuezk/GlobalProtect-openconnect
path: gp
- name: Checkout gpgui
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PAT }}
repository: yuezk/gpgui
path: gpgui
- name: Build gpgui
run: |
cd gpgui
make package
./target/release/gpgui --version
- name: Upload gpgui
uses: actions/upload-artifact@v3
with:
name: artifact-gpgui-${{ matrix.os }}
if-no-files-found: error
path: |
gpgui/.build/package/*.tar.xz*
gh-release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- build-deb
- build-rpm
- build-pkgbuild
- build-binary
- build-gpgui
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifact
- name: Create GH release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GH_PAT }}
prerelease: ${{ contains(github.ref, 'latest') }}
fail_on_unmatched_files: true
files: |
artifact/artifact-*/globalprotect-openconnect-*/.build/deb/*.deb
artifact/artifact-*/globalprotect-openconnect-*/.build/rpm/*.rpm
artifact/artifact-*/globalprotect-openconnect-*/.build/pkgbuild/*.pkg.tar.zst
artifact/artifact-*/globalprotect-openconnect-*/.build/binary/*.bin.tar.xz*
artifact/artifact-*/*.bin.tar.xz*
artifact/artifact-*/*.tar.gz