Release DEB #2
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: "Release DEB" | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to release' | |
required: true | |
arch: | |
type: choice | |
description: 'Architecture to build' | |
required: true | |
default: all | |
options: | |
- all | |
- x86_64 | |
- arm64 | |
gh-release: | |
type: boolean | |
description: 'Update GitHub release' | |
required: true | |
default: true | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check tag exists | |
uses: mukunku/tag-exists-action@v1.6.0 | |
id: check-tag | |
with: | |
tag: ${{ github.event.inputs.tag }} | |
- name: Exit if tag does not exist | |
run: | | |
if [[ "${{ steps.check-tag.outputs.exists }}" == "false" ]]; then | |
echo "Tag ${{ github.event.inputs.tag }} does not exist" | |
exit 1 | |
fi | |
# Include arm64 if ref is a tag | |
setup-matrix: | |
needs: | |
- check | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Set up matrix | |
id: set-matrix | |
run: | | |
if [[ "${{ github.event.inputs.arch }}" == "all" ]]; then | |
echo "matrix=[\"ubuntu-latest\", \"arm64\"]" >> $GITHUB_OUTPUT | |
elif [[ "${{ github.event.inputs.arch }}" == "x86_64" ]]; then | |
echo "matrix=[\"ubuntu-latest\"]" >> $GITHUB_OUTPUT | |
else | |
echo "matrix=[\"arm64\"]" >> $GITHUB_OUTPUT | |
fi | |
build: | |
needs: | |
- setup-matrix | |
strategy: | |
matrix: | |
os: ${{fromJson(needs.setup-matrix.outputs.matrix)}} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Prepare workspace | |
run: rm -rf build-deb && mkdir build-deb | |
- name: Download ${{ github.event.inputs.tag }} source code | |
uses: robinraju/release-downloader@v1.9 | |
with: | |
token: ${{ secrets.GH_PAT }} | |
tag: ${{ github.event.inputs.tag }} | |
fileName: globalprotect-openconnect-*.tar.gz | |
tarBall: false | |
zipBall: false | |
out-file-path: build-deb | |
- 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)/build-deb:/deb -e INCLUDE_GUI=1 yuezk/gpdev:deb-builder | |
- name: Install DEB package in Docker | |
run: | | |
docker run --rm -v $(pwd)/build-deb:/deb yuezk/gpdev:deb-builder \ | |
bash -c "sudo dpkg -i /deb/*.deb; gpclient -V; gpservice -V; gpauth -V; gpgui-helper -V; gpgui -V;" | |
- name: Upload DEB package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifact-deb-${{ matrix.os }} | |
if-no-files-found: error | |
path: | | |
build-deb/*.deb | |
gh-release: | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
if: ${{ github.event.inputs.gh-release == 'true' }} | |
steps: | |
- name: Prepare workspace | |
run: rm -rf gh-release && mkdir gh-release | |
- name: Download DEB package | |
uses: actions/download-artifact@v3 | |
with: | |
path: gh-release | |
- name: Update release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GH_PAT }} | |
prerelease: ${{ contains(github.ref, 'latest') }} | |
fail_on_unmatched_files: true | |
tag_name: ${{ github.event.inputs.tag }} | |
files: | | |
gh-release/artifact-*/* |