mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-07 04:20:12 +02:00
chore(ci): allow to specify provider to update servers data on dispatch
This commit is contained in:
@@ -1,6 +1,37 @@
|
|||||||
name: Update servers list
|
name: Update servers list
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
provider:
|
||||||
|
description: "VPN Provider to update"
|
||||||
|
required: true
|
||||||
|
default: "all"
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- all
|
||||||
|
- airvpn
|
||||||
|
- cyberghost
|
||||||
|
- expressvpn
|
||||||
|
- fastestvpn
|
||||||
|
- giganews
|
||||||
|
- hidemyass
|
||||||
|
- ipvanish
|
||||||
|
- ivpn
|
||||||
|
- mullvad
|
||||||
|
- nordvpn
|
||||||
|
- perfect privacy
|
||||||
|
- privado
|
||||||
|
- private internet access
|
||||||
|
- privatevpn
|
||||||
|
- protonvpn
|
||||||
|
- purevpn
|
||||||
|
- slickvpn
|
||||||
|
- surfshark
|
||||||
|
- torguard
|
||||||
|
- vpnsecure
|
||||||
|
- vpn unlimited
|
||||||
|
- vyprvpn
|
||||||
|
- windscribe
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "11 3 1 */2 *" # Run at 03:11 on the 1st of every 2nd month
|
- cron: "11 3 1 */2 *" # Run at 03:11 on the 1st of every 2nd month
|
||||||
jobs:
|
jobs:
|
||||||
@@ -20,7 +51,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Update servers list
|
- name: Update servers list
|
||||||
run: |
|
run: |
|
||||||
go run ./cmd/gluetun/main.go update -all -maintainer -proton-email "${{ secrets.PROTON_EMAIL }}" -proton-password "${{ secrets.PROTON_PASSWORD }}"
|
SELECTED_PROVIDER="${{ github.event.inputs.provider || 'all' }}"
|
||||||
|
|
||||||
|
if [ "$SELECTED_PROVIDER" = "all" ]; then
|
||||||
|
FLAGS="-all"
|
||||||
|
else
|
||||||
|
FLAGS="-providers $SELECTED_PROVIDER"
|
||||||
|
fi
|
||||||
|
|
||||||
|
go run ./cmd/gluetun/main.go update $FLAGS \
|
||||||
|
-maintainer \
|
||||||
|
-proton-email "${{ secrets.PROTON_EMAIL }}" \
|
||||||
|
-proton-password "${{ secrets.PROTON_PASSWORD }}"
|
||||||
|
|
||||||
- name: Check for changes
|
- name: Check for changes
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package providers
|
package providers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_All(t *testing.T) {
|
func Test_All(t *testing.T) {
|
||||||
@@ -21,3 +24,33 @@ func Test_AllWithCustom(t *testing.T) {
|
|||||||
assert.Contains(t, all, Custom)
|
assert.Contains(t, all, Custom)
|
||||||
assert.Len(t, all, len(All())+1)
|
assert.Len(t, all, len(All())+1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWorkflowHasAll(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
const path = "../../../.github/workflows/update-servers-list.yml"
|
||||||
|
file, err := os.Open(path)
|
||||||
|
require.NoError(t, err)
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
var data struct {
|
||||||
|
On struct {
|
||||||
|
WorkflowDispatch struct {
|
||||||
|
Inputs struct {
|
||||||
|
Provider struct {
|
||||||
|
Options []string `yaml:"options"`
|
||||||
|
} `yaml:"provider"`
|
||||||
|
} `yaml:"inputs"`
|
||||||
|
} `yaml:"workflow_dispatch"`
|
||||||
|
} `yaml:"on"`
|
||||||
|
}
|
||||||
|
decoder := yaml.NewDecoder(file)
|
||||||
|
err = decoder.Decode(&data)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
providers := All()
|
||||||
|
expected := make([]string, len(providers)+1)
|
||||||
|
expected[0] = "all"
|
||||||
|
copy(expected[1:], providers)
|
||||||
|
assert.Equal(t, expected, data.On.WorkflowDispatch.Inputs.Provider.Options)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user