Skip to content

Commit

Permalink
feat: mostrar URL de arquivos modificados
Browse files Browse the repository at this point in the history
  • Loading branch information
Misterio77 committed May 24, 2024
1 parent b4f1198 commit bf4c6aa
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,40 @@ jobs:
echo "staging_out=$staging_out" >> "$GITHUB_OUTPUT"
- name: Deploy
run: |
NIX_SSHOPTS="-p 2112" nix copy --to ssh://admin@galapagos.gelos.club ${{ steps.build.outputs.out-path }}
NIX_SSHOPTS="-p 2112" nix copy --to ssh://admin@galapagos.gelos.club ${{ steps.build.outputs.staging_out }}
dest="/srv/staging/${{ github.ref_name }}"
ssh admin@galapagos.gelos.club -p 2112 << EOF
mkdir -p "$(dirname "$dest")"
unlink "$dest" || rm -d "$dest" || true
ln -s "${{ steps.build.outputs.out-path }}/public" "$dest"
ln -s "${{ steps.build.outputs.staging_out }}/public" "$dest"
EOF
- name: Detectar arquivos alterados
id: diff
run: |
base_url="https://staging.gelos.club/${{ github.ref_name }}"
current="$(nix build --print-out-paths --no-link github:gelos-icmc/site)"
new="$(nix build --print-out-paths --no-link)"
# Show diff, for debugging
diff "$current" "$new" -qr
echo "urls<<EOF" >> "$GITHUB_OUTPUT"
while IFS= read -r line; do
# Limpar path, obter só URL relativo
path="$(echo $line | cut -d ' ' -f2)"
path="${path#"$current/public/"}"
# Adicionar ao output
if [ -n "$path" ]; then
echo "- [/$path]($base_url/$path)" >> "$GITHUB_OUTPUT"
fi
done <<< "$(diff "$current" "$new" -qr)"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Comentar commit
uses: peter-evans/commit-comment@v3
with:
token: ${{ steps.generate-token.outputs.token }}
body: |
Esse commit pode ser visualizado em:
https://staging.gelos.club/${{ github.ref_name }}
URLs modificadas:
${{ steps.diff.outputs.urls }}

0 comments on commit bf4c6aa

Please sign in to comment.