...
This commit is contained in:
@@ -44,93 +44,94 @@ jobs:
|
|||||||
uses: dcarbone/install-yq-action@v1
|
uses: dcarbone/install-yq-action@v1
|
||||||
|
|
||||||
- name: Install flarectl
|
- name: Install flarectl
|
||||||
if: steps.setup-go.outputs.cache-hit != 'true'
|
uses: tj-actions/setup-bin@v1.2.1
|
||||||
run: |
|
|
||||||
go install github.com/cloudflare/cloudflare-go/cmd/flarectl@latest
|
|
||||||
|
|
||||||
- name: Setup Go
|
|
||||||
id: setup-go
|
|
||||||
uses: actions/setup-go@v5.2.0
|
|
||||||
with:
|
with:
|
||||||
go-version: 'stable'
|
language-type: 'go'
|
||||||
cache: true
|
repository: cloudflare-go
|
||||||
cache-dependency-path: |
|
repository-owner: cloudflare
|
||||||
**/go.sum
|
|
||||||
**/go.mod
|
|
||||||
**/flarectl
|
|
||||||
|
|
||||||
- name: Setup jq
|
# - name: Setup Go
|
||||||
uses: dcarbone/install-jq-action@v3.0.1
|
# id: setup-go
|
||||||
|
# uses: actions/setup-go@v5.2.0
|
||||||
|
# with:
|
||||||
|
# go-version: 'stable'
|
||||||
|
# cache: true
|
||||||
|
# cache-dependency-path: |
|
||||||
|
# **/go.sum
|
||||||
|
# **/go.mod
|
||||||
|
# **/flarectl
|
||||||
|
|
||||||
|
# - name: Setup jq
|
||||||
|
# uses: dcarbone/install-jq-action@v3.0.1
|
||||||
|
|
||||||
- name: Retrieve Subdomains from Cloudflare & Compose
|
# - name: Retrieve Subdomains from Cloudflare & Compose
|
||||||
id: retrieve-cloudflare-subdomains
|
# id: retrieve-cloudflare-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 }}
|
||||||
run: |
|
# run: |
|
||||||
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
|
||||||
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
|
||||||
|
|
||||||
- name: Compare Subdomains
|
# - name: Compare Subdomains
|
||||||
id: compare-subdomains
|
# id: compare-subdomains
|
||||||
uses: LouisBrunner/diff-action@v2.2.0
|
# uses: LouisBrunner/diff-action@v2.2.0
|
||||||
with:
|
# with:
|
||||||
old: cloudflare_subdomains.txt
|
# old: cloudflare_subdomains.txt
|
||||||
new: compose_subdomains.txt
|
# new: compose_subdomains.txt
|
||||||
mode: mixed-worse
|
# mode: mixed-worse
|
||||||
output: missing_subdomains.txt
|
# output: missing_subdomains.txt
|
||||||
|
|
||||||
- name: Add missing subdomains to Cloudflare
|
# - name: Add missing subdomains to Cloudflare
|
||||||
if: steps.compare-subdomains.outputs.output != ''
|
# if: steps.compare-subdomains.outputs.output != ''
|
||||||
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: |
|
||||||
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..."
|
||||||
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:
|
||||||
name: Docker Compose Test
|
# name: Docker Compose Test
|
||||||
needs: [cloudflare-dns-setup]
|
# needs: [cloudflare-dns-setup]
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
steps:
|
# steps:
|
||||||
- name: Checkout
|
# - name: Checkout
|
||||||
uses: actions/checkout@v4
|
# uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Generate ephemeral .env compose file
|
# - name: Generate ephemeral .env compose file
|
||||||
id: generate-env-file-pr
|
# id: generate-env-file-pr
|
||||||
run: |
|
# run: |
|
||||||
echo "${{ secrets.RINOA_ENV }}" > .env
|
# echo "${{ secrets.RINOA_ENV }}" > .env
|
||||||
|
|
||||||
- name: Docker Compose Lint
|
# - name: Docker Compose Lint
|
||||||
uses: yu-ichiro/spin-up-docker-compose-action@v1
|
# uses: yu-ichiro/spin-up-docker-compose-action@v1
|
||||||
with:
|
# with:
|
||||||
file: docker-compose.yml
|
# file: docker-compose.yml
|
||||||
pull: true
|
# pull: true
|
||||||
pull-opts: --dry-run
|
# pull-opts: --dry-run
|
||||||
up: true
|
# up: true
|
||||||
up-opts: --dry-run -d --remove-orphans
|
# up-opts: --dry-run -d --remove-orphans
|
||||||
env:
|
# env:
|
||||||
DOCKER_HOST: tcp://dockerproxy:2375
|
# DOCKER_HOST: tcp://dockerproxy:2375
|
||||||
|
|
||||||
merge-pr:
|
# merge-pr:
|
||||||
name: PR Merge
|
# name: PR Merge
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
needs: [docker-compose-test]
|
# needs: [docker-compose-test]
|
||||||
steps:
|
# steps:
|
||||||
- name: Checkout
|
# - name: Checkout
|
||||||
uses: actions/checkout@v4
|
# uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Send Gotify Notification
|
# - name: Send Gotify Notification
|
||||||
uses: eikendev/gotify-action@0.0.3
|
# uses: eikendev/gotify-action@0.0.3
|
||||||
with:
|
# with:
|
||||||
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
# gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
||||||
gotify_app_token: '${{ secrets.GOTIFY_TOKEN }}'
|
# gotify_app_token: '${{ secrets.GOTIFY_TOKEN }}'
|
||||||
notification_title: '${{ github.ref_name }} ready to be merged.'
|
# notification_title: '${{ github.ref_name }} ready to be merged.'
|
||||||
notification_message: '${{ gitea.server_url }}/issues'
|
# notification_message: '${{ gitea.server_url }}/issues'
|
||||||
|
|
||||||
# - name: Manual Approval
|
# - name: Manual Approval
|
||||||
# uses: trstringer/manual-approval@v1
|
# uses: trstringer/manual-approval@v1
|
||||||
|
|||||||
Reference in New Issue
Block a user