1
0
reusable-workflows/.gitea/workflows/sendQAMail.yaml
2025-01-17 09:36:47 +01:00

58 lines
2.4 KiB
YAML

name: Send QA Mail
on:
workflow_call:
inputs:
version:
required: true
type: string
milestone:
required: true
type: string
tag:
required: true
type: string
jobs:
Mail:
runs-on: ubuntu-latest
steps:
- name: Install Mail Client
run: sudo apt-get update && sudo apt-get install -y msmtp
- name: Configure msmtp
run: |
echo "defaults" > ~/.msmtprc
echo "auth on" >> ~/.msmtprc
echo "tls on" >> ~/.msmtprc
echo "tls_starttls on" >> ~/.msmtprc
echo "account default" >> ~/.msmtprc
echo "host ${{ vars.SMTP_HOST }}" >> ~/.msmtprc
echo "port ${{ vars.SMTP_PORT }}" >> ~/.msmtprc
echo "user ${{ vars.SMTP_USER }}" >> ~/.msmtprc
echo "password ${{ vars.SMTP_PASSWORD }}" >> ~/.msmtprc
echo "from ${{ vars.SMTP_SENDER }}" >> ~/.msmtprc
chmod 600 ~/.msmtprc
- name: Create Email
run: |
REPOSITORY_NAME=$(basename ${{ env.GITHUB_REPOSITORY }})
echo "Subject: Neues Release: $REPOSITORY_NAME" > email.html
echo "From: ${{ vars.SMTP_SENDER }}" >> email.html
echo "To: ${{ vars.SMTP_QA_RECIPIENT }}" >> email.html
echo "Content-Type: text/html; charset=UTF-8" >> email.html
echo "" >> email.html
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD Html 4.01 Transitional//EN\">" >> email.html
echo "<html>" >> email.html
echo "<body>" >> email.html
echo "<h1>$REPOSITORY_NAME ${{ inputs.version }}</h1>" >> email.html
echo "<h1>Ein neues <a href=\"https://gitea.greyhound-software.com/${{ env.GITHUB_REPOSITORY }}/releases/tag/${{ inputs.tag }}\">Release</a> für $REPOSITORY_NAME wurde erstellt.</h1>" >> email.html
echo "<p><strong>Version:</strong> ${{ inputs.version }}</p>" >> email.html
echo "<p><strong>Milestone:</strong> ${{ inputs.milestone }}</p>" >> email.html
echo "<p>Eine Auflistung der gelösten Issues findest du <a href=\"https://gitea.greyhound-software.com/greyhound/dashboard/milestone/${{ inputs.milestone }}\">hier</a> </p>" >> email.html
echo "</body>" >> email.html
echo "</html>" >> email.html
- name: Send Email
run: |
msmtp --debug ${{ vars.SMTP_QA_RECIPIENT }} < email.html