-
Notifications
You must be signed in to change notification settings - Fork 12
98 lines (96 loc) · 3.44 KB
/
publish-aur-nym-vpnd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# 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
commit_msg:
description: "Commit message for the AUR repo (default to package version)"
type: string
required: 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/crates/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 ${{ env.TARBALL }} "https://github.com/${{ env.REPOSITORY }}/archive/refs/tags/${{ env.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/crates/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/crates/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.commit_msg || format('v{0}', steps.app-version.outputs.metadata) }}
assets: |
nym-vpn-core/crates/nym-vpnd/.pkg/aur/nym-vpnd.service