Skip to content

publish-aur-nym-vpnd #4

publish-aur-nym-vpnd

publish-aur-nym-vpnd #4

# Publish nym-vpnd on AUR
name: publish-aur-nym-vpnd
on:
workflow_dispatch:
inputs:
release_tag:
description: "Tag name of the release"
required: true
default: nym-vpn-core-v0.1.0
pkgrel:
description: "PKGBUILD package release number"
required: false
type: number
default: 1
publish_aur:
description: "publish PKGBUILD changes to AUR"
type: boolean
required: false
default: false
jobs:
aur-publish:
name: Publish package in AUR
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# bfs → build from sources
# bin → prebuilt
pkgtype: [bfs, bin]
include:
- pkgtype: bfs
pkgbuild: PKGBUILD
pkgname: nym-vpnd
- pkgtype: bin
pkgbuild: PKGBUILD-bin
pkgname: nym-vpnd-bin
env:
PKGNAME: ${{ matrix.pkgname }}
PKGBUILD: nym-vpn-core/nym-vpnd/.pkg/aur/${{ matrix.pkgbuild }}
PKGREL: ${{ inputs.pkgrel }}
RELEASE_TAG: ${{ inputs.release_tag }}
REPOSITORY: ${{ github.repository }}
TARBALL: sources.tar.gz
LINUX_BIN: linux-bin
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download sources
run: |
curl -LfsSo $TARBALL "https://github.com/$REPOSITORY/archive/refs/tags/$RELEASE_TAG.tar.gz"
mkdir tarball
tar -xzf $TARBALL -C tarball
- name: Get app version
id: app-version
uses: nicolaiunrein/cargo-get@master
with:
subcommand: package.version --entry="tarball/nym-vpn-client-${{ env.RELEASE_TAG }}/nym-vpn-core/nym-vpnd"
- name: Download prebuilt binary
if: matrix.pkgtype == 'bin'
run: |
curl -LfsSo $LINUX_BIN "https://github.com/$REPOSITORY/releases/download/$RELEASE_TAG/nym-vpn-core-v${{ steps.app-version.outputs.metadata }}_linux_x86_64.tar.gz"
- name: Update PKGBUILD
env:
PKGBUILD: ${{ env.PKGBUILD }}
PKGVER: ${{ steps.app-version.outputs.metadata }}
# SOURCES must be a multiline string
# ⚠ order is important and must match the order of
# the sources array declared in PKGBUILD
SOURCES: |
${{ matrix.pkgtype == 'bfs' && env.TARBALL || env.LINUX_BIN }}
nym-vpn-core/nym-vpnd/.pkg/aur/nym-vpnd.service
run: ./.pkg/aur_update.sh
- name: Rename PKGBUILD (bin)
if: matrix.pkgtype == 'bin'
run: |
# rename PKGBUILD-bin to PKGBUILD
mv ${{ env.PKGBUILD }} PKGBUILD
echo "PKGBUILD=./PKGBUILD" >> $GITHUB_ENV
- name: Show PKGBUILD
run: cat "$PKGBUILD"
- name: Publish
if: inputs.publish_aur == true
uses: KSXGitHub/[email protected]
with:
pkgname: ${{ env.PKGNAME }}
pkgbuild: ${{ env.PKGBUILD }}
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_KEY }}
commit_message: ${{ inputs.release_tag }}
assets: |
nym-vpn-core/nym-vpnd/.pkg/aur/nym-vpnd.service