....
This commit is contained in:
@@ -78,7 +78,7 @@ jobs:
|
|||||||
version: '0.113.0'
|
version: '0.113.0'
|
||||||
|
|
||||||
- name: Subdomain/CNAME Comparison & Creation
|
- name: Subdomain/CNAME Comparison & Creation
|
||||||
id: compare-subdomains
|
id: grab-subdomains
|
||||||
env:
|
env:
|
||||||
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
||||||
CF_API_EMAIL: ${{ secrets.CF_API_EMAIL }}
|
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
|
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..."
|
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
|
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: Compare Subdomains and Create Missing Ones
|
||||||
name: PR Merge
|
id: compare-subdomains
|
||||||
runs-on: ubuntu-latest
|
uses: LouisBrunner/diff-action@v2.2.0
|
||||||
needs: [cloudflare-dns-setup]
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Send Gotify Notification
|
|
||||||
uses: eikendev/gotify-action@0.0.3
|
|
||||||
with:
|
with:
|
||||||
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
old: compose_subdomains.txt
|
||||||
gotify_app_token: '${{ secrets.GOTIFY_TOKEN }}'
|
new: cloudflare_subdomains.txt
|
||||||
notification_title: '${{ github.ref_name }} ready to be merged.'
|
mode: 'addition'
|
||||||
notification_message: '${{ gitea.server_url }}/issues'
|
tolerance: mixed-better
|
||||||
|
|
||||||
- name: Manual Approval
|
- name: Create Missing Subdomains
|
||||||
uses: trstringer/manual-approval@v1
|
if: steps.compare-subdomains.outputs.output != ''
|
||||||
with:
|
run: |
|
||||||
secret: ${{ secrets.BOT_GITEA_TOKEN }}
|
echo ${{ steps.compare-subdomains.outputs.output }}
|
||||||
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
|
# merge-pr:
|
||||||
# run: |
|
# name: PR Merge
|
||||||
# curl -sSL https://dl.gitea.com/tea/main/tea-main-linux-amd64 -o /usr/local/bin/tea
|
# runs-on: ubuntu-latest
|
||||||
# chmod +x /usr/local/bin/tea
|
# needs: [cloudflare-dns-setup]
|
||||||
# echo "Merging PR..."
|
# steps:
|
||||||
# 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 }}
|
# - name: Checkout
|
||||||
# echo ${{ gitea.ref_name }}
|
# uses: actions/checkout@v4
|
||||||
# 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}
|
# - 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