This commit is contained in:
2024-12-31 20:15:31 -05:00
parent da213b12f8
commit 060604d0b9
+47 -41
View File
@@ -54,57 +54,63 @@ jobs:
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: |
echo $GOPATH if [ -z $(go env GOPATH) ]; then
echo $GOBIN export GOPATH=${{ github.workspace }}/go
if [ -z $(go env GOBIN) ]; then
export GOBIN=${{ github.workspace }}
echo "Installing flarectl..." echo "Installing flarectl..."
go install github.com/cloudflare/cloudflare-go/cmd/flarectl@latest go install github.com/cloudflare/cloudflare-go/cmd/flarectl@latest > 2>&1
echo "Grabbing most up-to-date subdomain list from Cloudflare..." echo "Grabbing most up-to-date subdomain list from Cloudflare..."
flarectl d l --zone trez.wtf --type CNAME --content trez.wtf | egrep -v 'ID' | awk '{print $5}' > cf_subdomain_list.txt ./flarectl d l --zone trez.wtf --type CNAME --content trez.wtf | egrep -v 'ID' | awk '{print $5}' > cf_subdomain_list.txt
swag_urls=$(yq '.services[].labels.swag_url' docker-compose.yml | egrep -v 'null' | sed -e 's|"||g' | awk -F'.' '{print $1}') swag_urls=$(yq '.services[].labels.swag_url' docker-compose.yml | egrep -v 'null' | sed -e 's|"||g' | awk -F'.' '{print $1}')
for subdomain in $(echo ${swag_urls}); do for subdomain in $(echo ${swag_urls}); do
echo "Checking for subdomain $subdomain..." if grep -q ${subdomain} cf_subdomain_list.txt; then
egrep -q "^${subdomain}" cf_subdomain_list.txt || echo "::notice::Subdomain $subdomain not found, creating record..." && flarectl d c --zone trez.wtf --name ${subdomain} --type CNAME --content trez.wtf --proxy echo "Subdomain ${subdomain}.trez.wtf already exists in Cloudflare. Skipping..."
else
echo "Subdomain ${subdomain}.trez.wtf does not exist in Cloudflare. Creating..."
flarectl d c --zone trez.wtf --name ${subdomain} --type CNAME --content trez.wtf --proxy
fi
done done
docker-compose-test: # docker-compose-test:
name: Docker Compose Test # name: Docker Compose Test
needs: [create-pr] # needs: [create-pr]
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