Add packaging #101
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-source | |
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 }} | |
steps: | |
- name: Download tarball | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifact-tarball | |
- name: Docker Login | |
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin | |
- name: Build DEB package in Docker | |
run: | | |
docker run --rm -v $(pwd):/deb yuezk/gpdev:deb-builder | |
- name: Install DEB package in Docker | |
run: | | |
docker run --rm -v $(pwd):/deb yuezk/gpdev:deb-builder \ | |
bash -c "sudo dpkg -i /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: | | |
./*.deb | |
build-rpm: | |
needs: | |
- setup-matrix | |
- tarball | |
strategy: | |
matrix: | |
os: ${{fromJson(needs.setup-matrix.outputs.matrix)}} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Download tarball | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifact-tarball | |
- name: Docker Login | |
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin | |
- name: Build RPM package in Docker | |
run: | | |
docker run --rm -v $(pwd):/rpm yuezk/gpdev:rpm-builder | |
- name: Install RPM package in Docker | |
run: | | |
docker run --rm -v $(pwd):/rpm yuezk/gpdev:rpm-builder \ | |
bash -c "sudo rpm -i /rpm/*.$(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: | | |
./*.rpm | |
build-pkgbuild: | |
needs: | |
- setup-matrix | |
- tarball | |
strategy: | |
matrix: | |
os: ${{fromJson(needs.setup-matrix.outputs.matrix)}} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Download tarball | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifact-tarball | |
- name: Docker Login | |
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin | |
- name: Build PKGBUILD package in Docker | |
run: | | |
docker run --rm -v $(pwd):/pkgbuild yuezk/gpdev:pkgbuild | |
- name: Install PKGBUILD package in Docker | |
run: | | |
docker run --rm -v $(pwd):/pkgbuild yuezk/gpdev:pkgbuild \ | |
bash -c "sudo pacman -U --noconfirm /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: | | |
./*.pkg.tar.zst | |
build-binary: | |
needs: | |
- setup-matrix | |
- tarball | |
strategy: | |
matrix: | |
os: ${{fromJson(needs.setup-matrix.outputs.matrix)}} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Download tarball | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifact-tarball | |
- name: Docker Login | |
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin | |
- name: Build binary in Docker | |
run: | | |
docker run --rm -v $(pwd):/binary yuezk/gpdev:binary-builder | |
- name: Install binary in Docker | |
run: | | |
tar -xJf ./*.bin.tar.xz | |
docker run --rm -v $(pwd):/binary yuezk/gpdev:binary-builder \ | |
bash -c "cd /binary/globalprotect-openconnect*/ && 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: | | |
*.bin.tar.xz | |
*.bin.tar.xz.sha256 | |
build-gpgui: | |
needs: | |
- setup-matrix | |
strategy: | |
matrix: | |
os: ${{fromJson(needs.setup-matrix.outputs.matrix)}} | |
runs-on: ${{ matrix.os }} | |
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: Tarball | |
run: | | |
tar -czf gpgui.tar.gz gpgui gp | |
- name: Docker Login | |
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin | |
- name: Build gpgui in Docker | |
run: | | |
docker run --rm -v $(pwd):/gpgui yuezk/gpdev:gpgui-builder | |
- name: Install gpgui in Docker | |
run: | | |
tar -xJf ./*.bin.tar.xz | |
docker run --rm -v $(pwd):/gpgui yuezk/gpdev:gpgui-builder \ | |
bash -c "cd /gpgui/gpgui_*/ && ./gpgui --version" | |
- name: Upload gpgui | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifact-gpgui-${{ matrix.os }} | |
if-no-files-found: error | |
path: | | |
./*.bin.tar.xz | |
./*.bin.tar.xz.sha256 | |
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-*/* |