infra/old/cluster/aprs/create-ghcr-secret.sh

28 lines
No EOL
936 B
Bash
Executable file

#!/bin/bash
# Script to create GitHub Container Registry pull secret for APRS
echo "This script will help you create a GitHub Container Registry pull secret"
echo "You need:"
echo "1. Your GitHub username"
echo "2. A GitHub Personal Access Token (PAT) with 'read:packages' scope"
echo ""
echo "To create a PAT:"
echo "1. Go to https://github.com/settings/tokens"
echo "2. Click 'Generate new token (classic)'"
echo "3. Select 'read:packages' scope"
echo "4. Generate the token"
echo ""
read -p "Enter your GitHub username: " GITHUB_USERNAME
read -s -p "Enter your GitHub PAT: " GITHUB_PAT
echo ""
kubectl create secret docker-registry ghcr-pull-secret \
--docker-server=ghcr.io \
--docker-username=$GITHUB_USERNAME \
--docker-password=$GITHUB_PAT \
--docker-email="${GITHUB_USERNAME}@users.noreply.github.com" \
--namespace=aprs \
--dry-run=client -o yaml | kubectl apply -f -
echo "Secret created/updated successfully!"