mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 14:36:15 -05:00
ci: enhance workflow inputs and series resolution for PPA publishing
This commit is contained in:
2 files changed
+76
-32
No files matched your search
@@ -1,6 +1,15 @@
|
|||||||
name: Build
|
name: Build
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
gp_branch:
|
||||||
|
description: 'GlobalProtect-openconnect branch to use for the snapshot release'
|
||||||
|
required: true
|
||||||
|
default: dev
|
||||||
|
gpgui_branch:
|
||||||
|
description: 'gpgui branch to use for the snapshot release'
|
||||||
|
required: true
|
||||||
|
default: dev
|
||||||
push:
|
push:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- LICENSE
|
- LICENSE
|
||||||
@@ -9,7 +18,6 @@ on:
|
|||||||
- .devcontainer
|
- .devcontainer
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- dev
|
|
||||||
- hotfix/*
|
- hotfix/*
|
||||||
- feature/*
|
- feature/*
|
||||||
- release/*
|
- release/*
|
||||||
@@ -21,7 +29,7 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Include arm64 if ref is a tag
|
# Include arm64 for tagged releases and manual snapshot releases.
|
||||||
setup-matrix:
|
setup-matrix:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
@@ -30,8 +38,8 @@ jobs:
|
|||||||
- name: Set up matrix
|
- name: Set up matrix
|
||||||
id: set-matrix
|
id: set-matrix
|
||||||
run: |
|
run: |
|
||||||
# Set the matrix to include arm64 if the ref is a tag or is the dev branch
|
# Set the matrix to include arm64 for tagged releases and manual snapshot releases.
|
||||||
if [[ "${{ github.ref }}" == "refs/tags/"* || "${{ github.ref }}" == "refs/heads/dev" ]]; then
|
if [[ "${{ github.ref }}" == "refs/tags/"* || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||||
echo 'matrix=[{"runner": "ubuntu-latest", "arch": "amd64"}, {"runner": "ubuntu-24.04-arm", "arch": "ubuntu-24.04-arm"}]' >> $GITHUB_OUTPUT
|
echo 'matrix=[{"runner": "ubuntu-latest", "arch": "amd64"}, {"runner": "ubuntu-24.04-arm", "arch": "ubuntu-24.04-arm"}]' >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo 'matrix=[{"runner": "ubuntu-latest", "arch": "amd64"}]' >> $GITHUB_OUTPUT
|
echo 'matrix=[{"runner": "ubuntu-latest", "arch": "amd64"}]' >> $GITHUB_OUTPUT
|
||||||
@@ -52,7 +60,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_PAT }}
|
token: ${{ secrets.GH_PAT }}
|
||||||
repository: yuezk/GlobalProtect-openconnect
|
repository: yuezk/GlobalProtect-openconnect
|
||||||
ref: ${{ github.ref }}
|
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.gp_branch || github.ref }}
|
||||||
path: source/gp
|
path: source/gp
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
@@ -69,7 +77,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Generate RPM spec file
|
- name: Generate RPM spec file
|
||||||
env:
|
env:
|
||||||
RELEASE_TAG: ${{ github.ref == 'refs/heads/dev' && 'snapshot' || github.ref_name }}
|
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && 'snapshot' || github.ref_name }}
|
||||||
run: |
|
run: |
|
||||||
cd source/gp
|
cd source/gp
|
||||||
|
|
||||||
@@ -88,7 +96,7 @@ jobs:
|
|||||||
source/artifacts/*
|
source/artifacts/*
|
||||||
|
|
||||||
tarball-offline:
|
tarball-offline:
|
||||||
if: ${{ github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/') }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- tarball
|
- tarball
|
||||||
@@ -195,15 +203,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_PAT }}
|
token: ${{ secrets.GH_PAT }}
|
||||||
repository: yuezk/GlobalProtect-openconnect
|
repository: yuezk/GlobalProtect-openconnect
|
||||||
ref: ${{ github.ref }}
|
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.gp_branch || github.ref }}
|
||||||
path: gpgui-source/gp
|
path: gpgui-source/gp
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Checkout gpgui@${{ github.ref_name }}
|
- name: Checkout gpgui
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_PAT }}
|
token: ${{ secrets.GH_PAT }}
|
||||||
repository: yuezk/gpgui
|
repository: yuezk/gpgui
|
||||||
ref: ${{ github.ref_name }}
|
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.gpgui_branch || github.ref_name }}
|
||||||
path: gpgui-source/gpgui
|
path: gpgui-source/gpgui
|
||||||
- name: Tarball
|
- name: Tarball
|
||||||
run: |
|
run: |
|
||||||
@@ -234,7 +242,7 @@ jobs:
|
|||||||
gpgui-source/*.bin.tar.xz.sha256
|
gpgui-source/*.bin.tar.xz.sha256
|
||||||
|
|
||||||
gh-release:
|
gh-release:
|
||||||
if: ${{ github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/') }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- tarball
|
- tarball
|
||||||
@@ -251,7 +259,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_PAT }}
|
token: ${{ secrets.GH_PAT }}
|
||||||
repository: yuezk/GlobalProtect-openconnect
|
repository: yuezk/GlobalProtect-openconnect
|
||||||
ref: ${{ github.ref }}
|
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.gp_branch || github.ref }}
|
||||||
path: gh-release/gp
|
path: gh-release/gp
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
@@ -263,6 +271,6 @@ jobs:
|
|||||||
- name: Create GH release
|
- name: Create GH release
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GH_PAT }}
|
GH_TOKEN: ${{ secrets.GH_PAT }}
|
||||||
RELEASE_TAG: ${{ github.ref == 'refs/heads/dev' && 'snapshot' || github.ref_name }}
|
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && 'snapshot' || github.ref_name }}
|
||||||
run: |
|
run: |
|
||||||
cd gh-release/gp/scripts && ./gh-release.sh "$RELEASE_TAG"
|
cd gh-release/gp/scripts && ./gh-release.sh "$RELEASE_TAG"
|
||||||
@@ -11,12 +11,7 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
default: "1"
|
default: "1"
|
||||||
series:
|
series:
|
||||||
description: 'Ubuntu series to publish'
|
description: 'Space-separated Ubuntu series. Leave empty to publish all supported series.'
|
||||||
type: "string"
|
|
||||||
required: false
|
|
||||||
default: ""
|
|
||||||
excluded_series:
|
|
||||||
description: 'Additional Ubuntu series to exclude from publishing'
|
|
||||||
type: "string"
|
type: "string"
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
@@ -30,20 +25,63 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check tag exists
|
- name: Check tag exists
|
||||||
uses: mukunku/[email protected]
|
env:
|
||||||
id: check-tag
|
GH_TOKEN: ${{ github.token }}
|
||||||
with:
|
TAG: ${{ inputs.tag }}
|
||||||
tag: ${{ inputs.tag }}
|
|
||||||
- name: Exit if tag does not exist
|
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ steps.check-tag.outputs.exists }}" == "false" ]]; then
|
if ! gh api "repos/${{ github.repository }}/git/ref/tags/$TAG" >/dev/null 2>&1; then
|
||||||
echo "Tag ${{ inputs.tag }} does not exist"
|
echo "Tag $TAG does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
publish-ppa:
|
resolve-series:
|
||||||
needs: check
|
needs: check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.resolve.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
- name: Resolve Ubuntu series
|
||||||
|
id: resolve
|
||||||
|
env:
|
||||||
|
INPUT_SERIES: ${{ inputs.series }}
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y distro-info distro-info-data
|
||||||
|
|
||||||
|
if [[ "$INPUT_SERIES" == *","* ]]; then
|
||||||
|
echo "Use space-separated series, for example: jammy noble" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
series=()
|
||||||
|
if [[ -z "${INPUT_SERIES// }" ]]; then
|
||||||
|
while IFS= read -r item; do
|
||||||
|
[[ -n "$item" ]] && series+=("$item")
|
||||||
|
done < <(ubuntu-distro-info --supported)
|
||||||
|
else
|
||||||
|
read -r -a series <<< "$INPUT_SERIES"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${#series[@]}" -eq 0 ]]; then
|
||||||
|
echo "No Ubuntu series resolved" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for item in "${series[@]}"; do
|
||||||
|
ubuntu-distro-info --series "$item" >/dev/null
|
||||||
|
done
|
||||||
|
|
||||||
|
matrix="$(printf '%s\n' "${series[@]}" | jq -R . | jq -s -c '{series: .}')"
|
||||||
|
echo "Resolved matrix: $matrix"
|
||||||
|
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
publish-ppa:
|
||||||
|
needs: [check, resolve-series]
|
||||||
|
name: publish-ppa (${{ matrix.series }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix: ${{ fromJSON(needs.resolve-series.outputs.matrix) }}
|
||||||
steps:
|
steps:
|
||||||
- uses: pnpm/action-setup@v5
|
- uses: pnpm/action-setup@v5
|
||||||
with:
|
with:
|
||||||
@@ -94,10 +132,8 @@ jobs:
|
|||||||
gpg_passphrase: ${{ secrets.PPA_GPG_PASSPHRASE }}
|
gpg_passphrase: ${{ secrets.PPA_GPG_PASSPHRASE }}
|
||||||
tarball: publish-ppa/globalprotect-openconnect-*.tar.gz
|
tarball: publish-ppa/globalprotect-openconnect-*.tar.gz
|
||||||
debian_dir: publish-ppa/globalprotect-openconnect-*/.build/debian
|
debian_dir: publish-ppa/globalprotect-openconnect-*/.build/debian
|
||||||
deb_email: "[email protected]"
|
deb_email: ${{ vars.DEB_EMAIL }}
|
||||||
deb_fullname: "Kevin Yue"
|
deb_fullname: ${{ vars.DEB_FULLNAME }}
|
||||||
extra_ppa: "yuezk/globalprotect-openconnect"
|
extra_ppa: "yuezk/globalprotect-openconnect"
|
||||||
# Ubuntu 18.04 and 20.04 are excluded because tauri2 no longer supports them
|
series: ${{ matrix.series }}
|
||||||
excluded_series: "bionic focal ${{ inputs.excluded_series }}"
|
|
||||||
series: ${{ inputs.series }}
|
|
||||||
revision: ${{ inputs.revision }}
|
revision: ${{ inputs.revision }}
|
||||||
Reference in new issue
Block a user