...
This commit is contained in:
@@ -43,25 +43,30 @@ jobs:
|
|||||||
- name: Setup yq
|
- name: Setup yq
|
||||||
uses: dcarbone/install-yq-action@v1
|
uses: dcarbone/install-yq-action@v1
|
||||||
|
|
||||||
|
- name: Install jq
|
||||||
|
uses: dcarbone/install-jq-action@v3.0.1
|
||||||
|
|
||||||
- name: Grab subdomains from Compose
|
- name: Grab subdomains from Compose
|
||||||
id: compose-domains
|
id: compose-domains
|
||||||
env:
|
env:
|
||||||
CF_API_KEY: ${{ secrets.CF_API_TOKEN }}
|
CF_API_KEY: ${{ secrets.CF_API_TOKEN }}
|
||||||
CF_API_EMAIL: ${{ secrets.CF_API_EMAIL }}
|
CF_API_EMAIL: ${{ secrets.CF_API_EMAIL }}
|
||||||
run: |
|
run: |
|
||||||
yq '.services[].labels.swag_url' docker-compose.yml | egrep -v 'null' | sed -e 's|"||g' | awk -F'.' '{print $1}' > compose_subdomains.txt
|
yq '.services[].labels.swag_url' docker-compose.yml | egrep -v 'null' | sed -e 's|"||g' | awk -F'.' '{print $1}' | sort -u > compose_subdomains.txt
|
||||||
|
|
||||||
- name: Retrieve subdomains in Cloudflare
|
- name: Retrieve Cloudflare Subdomains
|
||||||
uses: addnab/docker-run-action@v3
|
id: compare-subdomains
|
||||||
env:
|
env:
|
||||||
DOCKER_HOST: tcp://dockerproxy:2375
|
DOCKER_HOST: tcp://dockerproxy:2375
|
||||||
with:
|
run: |
|
||||||
image: quay.io/aminvakil/flarectl:latest
|
cat > ${{ github.workspace }}/cloudflare.env <<EOF
|
||||||
options: -v ${{ github.workspace }}:/workspace -e CF_API_KEY=${{ secrets.CF_API_TOKEN }} -e CF_API_EMAIL=${{ secrets.CF_API_EMAIL }}
|
CF_API_KEY=${{ secrets.CF_API_TOKEN }}
|
||||||
run: |
|
CF_API_EMAIL=${{ secrets.CF_API_EMAIL }}
|
||||||
flarectl --json dns list --zone ${{ secrets.CF_ZONE_ID }} --type CNAME --content "trez.wtf" | > /workspace/cloudflare_subdomains.txt
|
EOF
|
||||||
|
alias flarectl="docker run -it --rm --env-file cloudflare.env quay.io/aminvakil/flarectl:latest flarectl"
|
||||||
|
flarectl --json dns list --zone ${{ secrets.CF_ZONE_ID }} --type CNAME --content "trez.wtf" | jq '.[].Name' | sed -e 's|"||g' | awk -F. '{print $1}' | sort > cloudflare_subdomains.txt
|
||||||
|
|
||||||
- name: Compare & Create Missing Subdomains
|
- name: Compare Subdomains
|
||||||
id: compare-subdomains
|
id: compare-subdomains
|
||||||
env:
|
env:
|
||||||
DOCKER_HOST: tcp://dockerproxy:2375
|
DOCKER_HOST: tcp://dockerproxy:2375
|
||||||
@@ -75,13 +80,9 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "No missing subdomains found."
|
echo "No missing subdomains found."
|
||||||
fi
|
fi
|
||||||
cat > ${{ github.workspace }}/cloudflare.env <<EOF
|
|
||||||
CF_API_KEY=${{ secrets.CF_API_TOKEN }}
|
|
||||||
CF_API_EMAIL=${{ secrets.CF_API_EMAIL }}
|
|
||||||
EOF
|
|
||||||
for subdomain in $(cat missing_subdomains.txt); do
|
for subdomain in $(cat missing_subdomains.txt); do
|
||||||
echo "Adding ${subdomain} to Cloudflare..."
|
echo "Adding ${subdomain} to Cloudflare..."
|
||||||
docker run -it --rm --env-file cloudflare.env quay.io/aminvakil/flarectl:latest flarectl dns creeate --zone ${{ secrets.CF_ZONE_ID }} --type CNAME --name "${subdomain}" --content "trez.wtf" --proxy true
|
flarectl dns creeate --zone ${{ secrets.CF_ZONE_ID }} --type CNAME --name "${subdomain}" --content "trez.wtf" --proxy true
|
||||||
done
|
done
|
||||||
|
|
||||||
# docker-compose-test:
|
# docker-compose-test:
|
||||||
|
|||||||
Reference in New Issue
Block a user