1010# binários + archives + GitHub Release
1111# ↓
1212# (se AUR_KEY configurado) AUR push
13+ #
14+ # ── AUR secret setup ──────────────────────────────────────────────────────────
15+ # The AUR_KEY secret MUST be stored as base64 to avoid newline corruption.
16+ # GitHub Actions mangles multi-line secrets; base64 encodes them to a single
17+ # line that is decoded byte-for-byte back to the original key file.
18+ #
19+ # One-time setup — encode your AUR SSH private key and store it as AUR_KEY:
20+ #
21+ # Linux: base64 -w 0 ~/.ssh/aur > aur_key_b64.txt
22+ # macOS: base64 -i ~/.ssh/aur > aur_key_b64.txt
23+ #
24+ # Copy the content of aur_key_b64.txt and paste it as the AUR_KEY secret at:
25+ # Settings → Secrets and variables → Actions → New repository secret
1326# ==============================================================================
1427
1528name : Release
1629
1730on :
1831 push :
1932 tags :
20- - " v[0-9]+.[0-9]+.[0-9]+" # v1.2.3
33+ - " v[0-9]+.[0-9]+.[0-9]+" # v1.2.3
2134 - " v[0-9]+.[0-9]+.[0-9]+-*" # v1.2.3-beta.1 (pre-release)
2235
2336# Minimum permissions required for goreleaser to create the release
@@ -55,23 +68,30 @@ jobs:
5568 - name : Test
5669 run : go test -race ./...
5770
71+ # Decodes the base64-encoded AUR_KEY secret into a proper PEM key file.
5872 # goreleaser v2 requires private_key to be a FILE PATH, not inline content.
59- # This step writes the secret to a temp file and exposes its path.
60- # If AUR_KEY is absent the AUR publisher is skipped via --skip=aurs.
73+ # Storing the key as base64 avoids the newline corruption that GitHub
74+ # Actions causes when expanding multi-line secrets — which triggers
75+ # "error in libcrypto" from OpenSSH when it tries to parse the key.
6176 - name : Setup AUR key
6277 id : aur
6378 env :
64- AUR_KEY_CONTENT : ${{ secrets.AUR_KEY }}
79+ AUR_KEY_B64 : ${{ secrets.AUR_KEY }}
6580 run : |
66- if [ -n "$AUR_KEY_CONTENT " ]; then
81+ if [ -n "$AUR_KEY_B64 " ]; then
6782 mkdir -p ~/.ssh
68- echo "$AUR_KEY_CONTENT" > ~/.ssh/aur_key
83+ echo "$AUR_KEY_B64" | base64 -d > ~/.ssh/aur_key
6984 chmod 600 ~/.ssh/aur_key
70- echo "key_path=$HOME/.ssh/aur_key" >> "$GITHUB_OUTPUT"
71- echo "goreleaser_args=release --clean" >> "$GITHUB_OUTPUT"
85+ # Validate the decoded key is parseable before proceeding
86+ if ssh-keygen -l -f ~/.ssh/aur_key > /dev/null 2>&1; then
87+ echo "has_key=true" >> "$GITHUB_OUTPUT"
88+ else
89+ echo "::error title=AUR_KEY inválida::A chave decodificada não é um arquivo de chave SSH válido."
90+ echo "::error title=AUR_KEY inválida::Verifique se o secret foi armazenado em base64 (veja o comentário no topo deste arquivo)."
91+ echo "has_key=false" >> "$GITHUB_OUTPUT"
92+ fi
7293 else
73- echo "key_path=" >> "$GITHUB_OUTPUT"
74- echo "goreleaser_args=release --clean --skip=aurs" >> "$GITHUB_OUTPUT"
94+ echo "has_key=false" >> "$GITHUB_OUTPUT"
7595 echo "::warning title=AUR_KEY ausente::Publicação no AUR ignorada. Configure o secret AUR_KEY para habilitar."
7696 fi
7797
@@ -80,14 +100,16 @@ jobs:
80100 with :
81101 distribution : goreleaser
82102 version : " ~> v2"
83- args : ${{ steps.aur.outputs.goreleaser_args }}
103+ args : >-
104+ release --clean
105+ ${{ steps.aur.outputs.has_key != 'true' && '--skip=aurs' || '' }}
84106 env :
85107 # GitHub token to create the release and upload assets.
86108 # GITHUB_TOKEN is automatically injected by Actions — no extra configuration needed.
87109 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
88- # Path to the SSH private key file written by the "Setup AUR key" step above .
89- # goreleaser v2 requires a file path here, not inline key content .
90- AUR_KEY : ${{ steps.aur.outputs.key_path }}
110+ # goreleaser v2 expects a FILE PATH for private_key, not inline key content .
111+ # Points to the file written and validated by the "Setup AUR key" step above .
112+ AUR_KEY : /home/runner/.ssh/aur_key
91113
92114 # ── Completion notification ───────────────────────────────────────────────────
93115 notify :
0 commit comments