mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 06:26:14 -05:00
ci: publish OBS and COPR packages
This commit is contained in:
2 files changed
+152
No files matched your search
@@ -0,0 +1,80 @@
|
|||||||
|
name: Publish COPR
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: 'Tag to publish'
|
||||||
|
required: true
|
||||||
|
revision:
|
||||||
|
description: 'Package revision'
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: "1"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-copr:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: fedora:latest
|
||||||
|
steps:
|
||||||
|
- name: Install tools
|
||||||
|
run: dnf install -y copr-cli gh
|
||||||
|
|
||||||
|
- name: Check inputs
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
TAG: ${{ inputs.tag }}
|
||||||
|
REVISION: ${{ inputs.revision }}
|
||||||
|
run: |
|
||||||
|
if [[ ! "$REVISION" =~ ^[1-9][0-9]*$ ]]; then
|
||||||
|
echo "Revision must be a positive integer" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
gh api "repos/${{ github.repository }}/git/ref/tags/$TAG" >/dev/null
|
||||||
|
|
||||||
|
- name: Download published spec
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
TAG: ${{ inputs.tag }}
|
||||||
|
run: |
|
||||||
|
mkdir -p publish-copr
|
||||||
|
|
||||||
|
gh release download "$TAG" \
|
||||||
|
--repo "${{ github.repository }}" \
|
||||||
|
--pattern globalprotect-openconnect.spec \
|
||||||
|
--dir publish-copr
|
||||||
|
|
||||||
|
- name: Set package revision
|
||||||
|
env:
|
||||||
|
REVISION: ${{ inputs.revision }}
|
||||||
|
run: |
|
||||||
|
spec=publish-copr/globalprotect-openconnect.spec
|
||||||
|
|
||||||
|
if [[ "$(grep -c '^Release:' "$spec")" -ne 1 ]]; then
|
||||||
|
echo "Expected exactly one Release field in $spec" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -Ei \
|
||||||
|
"s/^Release:[[:space:]]+.*/Release: ${REVISION}%{?dist}/" \
|
||||||
|
"$spec"
|
||||||
|
|
||||||
|
grep '^Release:' "$spec"
|
||||||
|
|
||||||
|
- name: Configure COPR authentication
|
||||||
|
env:
|
||||||
|
COPR_CONFIG: ${{ secrets.COPR_CONFIG }}
|
||||||
|
run: |
|
||||||
|
install -d -m 700 "$HOME/.config"
|
||||||
|
printf '%s\n' "$COPR_CONFIG" > "$HOME/.config/copr"
|
||||||
|
chmod 600 "$HOME/.config/copr"
|
||||||
|
|
||||||
|
- name: Build and publish COPR package
|
||||||
|
run: |
|
||||||
|
copr-cli build \
|
||||||
|
yuezk/globalprotect-openconnect \
|
||||||
|
publish-copr/globalprotect-openconnect.spec
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
name: Publish OBS
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: 'Tag to publish'
|
||||||
|
required: true
|
||||||
|
revision:
|
||||||
|
description: 'Package revision'
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: "1"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-obs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check inputs
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
TAG: ${{ inputs.tag }}
|
||||||
|
REVISION: ${{ inputs.revision }}
|
||||||
|
run: |
|
||||||
|
if [[ ! "$REVISION" =~ ^[1-9][0-9]*$ ]]; then
|
||||||
|
echo "Revision must be a positive integer" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
gh api "repos/${{ github.repository }}/git/ref/tags/$TAG" >/dev/null
|
||||||
|
|
||||||
|
- name: Prepare OBS package
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
TAG: ${{ inputs.tag }}
|
||||||
|
REVISION: ${{ inputs.revision }}
|
||||||
|
run: |
|
||||||
|
version="${TAG#v}"
|
||||||
|
archive="globalprotect-openconnect-${version}.offline.tar.gz"
|
||||||
|
source_dir="publish-obs/source/globalprotect-openconnect-${version}"
|
||||||
|
|
||||||
|
mkdir -p publish-obs/files publish-obs/source
|
||||||
|
|
||||||
|
gh release download "$TAG" \
|
||||||
|
--repo "${{ github.repository }}" \
|
||||||
|
--pattern "$archive" \
|
||||||
|
--dir publish-obs
|
||||||
|
|
||||||
|
tar -xzf "publish-obs/$archive" -C publish-obs/source
|
||||||
|
|
||||||
|
make -C "$source_dir" init-rpm \
|
||||||
|
REVISION="$REVISION" \
|
||||||
|
RPM_SOURCE='%{name}.tar.gz'
|
||||||
|
|
||||||
|
mv "publish-obs/$archive" \
|
||||||
|
publish-obs/files/globalprotect-openconnect.tar.gz
|
||||||
|
cp "$source_dir/.build/rpm/globalprotect-openconnect.spec" \
|
||||||
|
"$source_dir/.build/rpm/globalprotect-openconnect.changes" \
|
||||||
|
publish-obs/files/
|
||||||
|
|
||||||
|
- name: Publish OBS package
|
||||||
|
uses: yuezk/publish-obs-package@main
|
||||||
|
with:
|
||||||
|
project: home:yuezk
|
||||||
|
package: globalprotect-openconnect
|
||||||
|
username: yuezk
|
||||||
|
password: ${{ secrets.OBS_PASSWORD }}
|
||||||
|
files: ./publish-obs/files/*
|
||||||
|
commit_message: 'Release ${{ inputs.tag }}-${{ inputs.revision }}'
|
||||||
Reference in new issue
Block a user