....
This commit is contained in:
@@ -78,7 +78,7 @@ jobs:
|
||||
version: '0.113.0'
|
||||
|
||||
- name: Subdomain/CNAME Comparison & Creation
|
||||
id: compare-subdomains
|
||||
id: grab-subdomains
|
||||
env:
|
||||
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
||||
CF_API_EMAIL: ${{ secrets.CF_API_EMAIL }}
|
||||
@@ -88,53 +88,55 @@ jobs:
|
||||
flarectl --json dns list --zone "trez.wtf" --type=CNAME --content "trez.wtf" | jq '.[].Name' | sed -e 's|"||g' | awk -F"." '{print $1}' | sort > cloudflare_subdomains.txt
|
||||
echo "Grabbing subdomains from docker-compose.yml..."
|
||||
yq '.services[].labels.swag_url' docker-compose.yml | egrep -v 'null' | sed -e 's|"||g' | awk -F'.' '{print $1}' | sort > compose_subdomains.txt
|
||||
which diff
|
||||
diff compose_subdomains.txt cloudflare_subdomains.txt | egrep '<' | awk '{print $2}' > missing_subdomains.txt
|
||||
cat missing_subdomains.txt
|
||||
if [ -s missing_subdomains.txt ]; then
|
||||
echo "Missing subdomains found. Creating them..."
|
||||
while IFS= read -r subdomain; do
|
||||
echo "Creating $subdomain.trez.wtf..."
|
||||
flarectl dns create --zone "trez.wtf" --name "$subdomain" --type CNAME --content "trez.wtf"
|
||||
done < missing_subdomains.txt
|
||||
else
|
||||
echo "No missing subdomains found."
|
||||
fi
|
||||
|
||||
merge-pr:
|
||||
name: PR Merge
|
||||
runs-on: ubuntu-latest
|
||||
needs: [cloudflare-dns-setup]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Send Gotify Notification
|
||||
uses: eikendev/gotify-action@0.0.3
|
||||
- name: Compare Subdomains and Create Missing Ones
|
||||
id: compare-subdomains
|
||||
uses: LouisBrunner/diff-action@v2.2.0
|
||||
with:
|
||||
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
||||
gotify_app_token: '${{ secrets.GOTIFY_TOKEN }}'
|
||||
notification_title: '${{ github.ref_name }} ready to be merged.'
|
||||
notification_message: '${{ gitea.server_url }}/issues'
|
||||
old: compose_subdomains.txt
|
||||
new: cloudflare_subdomains.txt
|
||||
mode: 'addition'
|
||||
tolerance: mixed-better
|
||||
|
||||
- name: Manual Approval
|
||||
uses: trstringer/manual-approval@v1
|
||||
with:
|
||||
secret: ${{ secrets.BOT_GITEA_TOKEN }}
|
||||
approvers: Trez.One
|
||||
minimum-approvals: 1
|
||||
issue-title: "Deployment of ${{ github.ref_name }}"
|
||||
issue-body: "Autobots, roll out!"
|
||||
exclude-workflow-initiator-as-approver: false
|
||||
additional-approved-words: ''
|
||||
additional-denied-words: ''
|
||||
- name: Create Missing Subdomains
|
||||
if: steps.compare-subdomains.outputs.output != ''
|
||||
run: |
|
||||
echo ${{ steps.compare-subdomains.outputs.output }}
|
||||
|
||||
# - name: Tea CLI Setup & PR Merge
|
||||
# run: |
|
||||
# curl -sSL https://dl.gitea.com/tea/main/tea-main-linux-amd64 -o /usr/local/bin/tea
|
||||
# chmod +x /usr/local/bin/tea
|
||||
# echo "Merging PR..."
|
||||
# tea login add --name gitea-rinoa --url ${{ vars.RINOA_GITEA_URL }} --user gitea-sonarqube-bot --password "${{ secrets.BOT_GITEA_PASSWORD }}" --token ${{ secrets.BOT_GITEA_TOKEN }}
|
||||
# echo ${{ gitea.ref_name }}
|
||||
# pr_index=$(tea pr ls --repo ${{ github.repository }} --state open --fields index,title,head,state --output csv | egrep ${{ gitea.ref_name }} | awk -F, '{print $1}' | sed -e 's|"||g')
|
||||
# tea pr m --repo ${{ github.repository }} --title "Auto Merge" --message "Merged by ${{ gitea.actor }}" --output table ${pr_index}
|
||||
# merge-pr:
|
||||
# name: PR Merge
|
||||
# runs-on: ubuntu-latest
|
||||
# needs: [cloudflare-dns-setup]
|
||||
# steps:
|
||||
# - name: Checkout
|
||||
# uses: actions/checkout@v4
|
||||
|
||||
# - name: Send Gotify Notification
|
||||
# uses: eikendev/gotify-action@0.0.3
|
||||
# with:
|
||||
# gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
||||
# gotify_app_token: '${{ secrets.GOTIFY_TOKEN }}'
|
||||
# notification_title: '${{ github.ref_name }} ready to be merged.'
|
||||
# notification_message: '${{ gitea.server_url }}/issues'
|
||||
|
||||
# - name: Manual Approval
|
||||
# uses: trstringer/manual-approval@v1
|
||||
# with:
|
||||
# secret: ${{ secrets.BOT_GITEA_TOKEN }}
|
||||
# approvers: Trez.One
|
||||
# minimum-approvals: 1
|
||||
# issue-title: "Deployment of ${{ github.ref_name }}"
|
||||
# issue-body: "Autobots, roll out!"
|
||||
# exclude-workflow-initiator-as-approver: false
|
||||
# additional-approved-words: ''
|
||||
# additional-denied-words: ''
|
||||
|
||||
# - name: Tea CLI Setup & PR Merge
|
||||
# run: |
|
||||
# curl -sSL https://dl.gitea.com/tea/main/tea-main-linux-amd64 -o /usr/local/bin/tea
|
||||
# chmod +x /usr/local/bin/tea
|
||||
# echo "Merging PR..."
|
||||
# tea login add --name gitea-rinoa --url ${{ vars.RINOA_GITEA_URL }} --user gitea-sonarqube-bot --password "${{ secrets.BOT_GITEA_PASSWORD }}" --token ${{ secrets.BOT_GITEA_TOKEN }}
|
||||
# echo ${{ gitea.ref_name }}
|
||||
# pr_index=$(tea pr ls --repo ${{ github.repository }} --state open --fields index,title,head,state --output csv | egrep ${{ gitea.ref_name }} | awk -F, '{print $1}' | sed -e 's|"||g')
|
||||
# tea pr m --repo ${{ github.repository }} --title "Auto Merge" --message "Merged by ${{ gitea.actor }}" --output table ${pr_index}
|
||||
Reference in New Issue
Block a user