From f7e15834ea252d8d27278ca1b01ced0376878866 Mon Sep 17 00:00:00 2001 From: Mike Landau Date: Tue, 4 Mar 2025 14:30:06 -0800 Subject: [PATCH 1/8] [cicd] publish nightly --- .github/workflows/cli-tests.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/cli-tests.yaml b/.github/workflows/cli-tests.yaml index 192c11909e5..33faffb9fb6 100644 --- a/.github/workflows/cli-tests.yaml +++ b/.github/workflows/cli-tests.yaml @@ -67,6 +67,24 @@ jobs: name: devbox-${{ runner.os }}-${{ runner.arch }} path: ./dist/devbox retention-days: 7 + - name: Publish to Cloudflare DNS + # comment out for testing + # if: github.event_name == 'schedule' # Only run on nightly builds + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} + run: | + ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" + curl -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/dns_records" \ + -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ + -H "Content-Type: application/json" \ + --data '{ + "type": "CNAME", + "name": "nightly-${{ runner.os }}", + "content": "'$ARTIFACT_URL'", + "ttl": 1, + "proxied": tru + }' typos: name: Spell Check with Typos From 1c9b326195c590f3419df58d5f797be05a81e78d Mon Sep 17 00:00:00 2001 From: Mike Landau Date: Tue, 4 Mar 2025 14:31:43 -0800 Subject: [PATCH 2/8] fix --- .github/workflows/cli-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli-tests.yaml b/.github/workflows/cli-tests.yaml index 33faffb9fb6..8551ed8e190 100644 --- a/.github/workflows/cli-tests.yaml +++ b/.github/workflows/cli-tests.yaml @@ -83,7 +83,7 @@ jobs: "name": "nightly-${{ runner.os }}", "content": "'$ARTIFACT_URL'", "ttl": 1, - "proxied": tru + "proxied": true }' typos: From 02b648d45db905835e4a7536434f436679e71804 Mon Sep 17 00:00:00 2001 From: Mike Landau Date: Tue, 4 Mar 2025 14:33:33 -0800 Subject: [PATCH 3/8] fix 2 --- .github/workflows/cli-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli-tests.yaml b/.github/workflows/cli-tests.yaml index 8551ed8e190..3402e719d66 100644 --- a/.github/workflows/cli-tests.yaml +++ b/.github/workflows/cli-tests.yaml @@ -74,7 +74,7 @@ jobs: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} run: | - ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" + ARTIFACT_URL="github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" curl -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/dns_records" \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ -H "Content-Type: application/json" \ From 5801ca2b0191eac876183d2136b58cae59e23537 Mon Sep 17 00:00:00 2001 From: Mike Landau Date: Tue, 4 Mar 2025 15:54:26 -0800 Subject: [PATCH 4/8] fix 3 --- .github/workflows/cli-tests.yaml | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cli-tests.yaml b/.github/workflows/cli-tests.yaml index 3402e719d66..5789dc5c478 100644 --- a/.github/workflows/cli-tests.yaml +++ b/.github/workflows/cli-tests.yaml @@ -69,22 +69,30 @@ jobs: retention-days: 7 - name: Publish to Cloudflare DNS # comment out for testing - # if: github.event_name == 'schedule' # Only run on nightly builds + # if: github.event_name == 'schedule' && matrix.os == 'ubuntu-latest' # Only run on nightly builds for Ubuntu env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} + CLOUDFLARE_DEV_JETIFY_COM_ZONE_ID: ${{ secrets.CLOUDFLARE_DEV_JETIFY_COM_ZONE_ID }} run: | ARTIFACT_URL="github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" - curl -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/dns_records" \ - -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ - -H "Content-Type: application/json" \ + curl --request PATCH \ + "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_DEV_JETIFY_COM_ZONE_ID/rulesets/8e90f56d9df8499ebf5023d188d62d99/rules/ef569446f76946ff9ebf910320eed88c" \ + --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ + --header "Content-Type: application/json" \ --data '{ - "type": "CNAME", - "name": "nightly-${{ runner.os }}", - "content": "'$ARTIFACT_URL'", - "ttl": 1, - "proxied": true - }' + "expression": "(http.host eq \"nightly-ubuntu.dev-jetify.com\")", + "description": "Redirect nightly build requests to GitHub artifacts", + "action": "redirect", + "action_parameters": { + "from_value": { + "target_url": { + "value": "https://'$ARTIFACT_URL'" + }, + "status_code": 302, + "preserve_query_string": false + } + } + }' typos: name: Spell Check with Typos From 2768998007dd594f65d428af826dca5acc7624cc Mon Sep 17 00:00:00 2001 From: Mike Landau Date: Tue, 4 Mar 2025 15:56:07 -0800 Subject: [PATCH 5/8] fix 4 --- .github/workflows/cli-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli-tests.yaml b/.github/workflows/cli-tests.yaml index 5789dc5c478..80905ea6a11 100644 --- a/.github/workflows/cli-tests.yaml +++ b/.github/workflows/cli-tests.yaml @@ -76,7 +76,7 @@ jobs: run: | ARTIFACT_URL="github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" curl --request PATCH \ - "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_DEV_JETIFY_COM_ZONE_ID/rulesets/8e90f56d9df8499ebf5023d188d62d99/rules/ef569446f76946ff9ebf910320eed88c" \ + "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_DEV_JETIFY_COM_ZONE_ID/rulesets/8e90f56d9df8499ebf5023d188d62d99/rules/fab5cd9a2e574e0aa6ab73d622d6a350" \ --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ --header "Content-Type: application/json" \ --data '{ From 1f114bb8ba30031e36a21c912c037e460a511283 Mon Sep 17 00:00:00 2001 From: Mike Landau Date: Tue, 4 Mar 2025 16:02:41 -0800 Subject: [PATCH 6/8] Fix link --- .github/workflows/cli-tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cli-tests.yaml b/.github/workflows/cli-tests.yaml index 80905ea6a11..dbd6cb4d7af 100644 --- a/.github/workflows/cli-tests.yaml +++ b/.github/workflows/cli-tests.yaml @@ -62,6 +62,7 @@ jobs: - name: Build devbox run: go build -o dist/devbox ./cmd/devbox - name: Upload devbox artifact + id: upload-artifact uses: actions/upload-artifact@v4 with: name: devbox-${{ runner.os }}-${{ runner.arch }} @@ -74,7 +75,7 @@ jobs: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} CLOUDFLARE_DEV_JETIFY_COM_ZONE_ID: ${{ secrets.CLOUDFLARE_DEV_JETIFY_COM_ZONE_ID }} run: | - ARTIFACT_URL="github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" + ARTIFACT_URL="github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.upload-artifact.outputs.artifact-id }}" curl --request PATCH \ "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_DEV_JETIFY_COM_ZONE_ID/rulesets/8e90f56d9df8499ebf5023d188d62d99/rules/fab5cd9a2e574e0aa6ab73d622d6a350" \ --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ From ec9498d5b62af985097765cbb8ba5c8f1fe890fa Mon Sep 17 00:00:00 2001 From: Mike Landau Date: Tue, 4 Mar 2025 16:15:37 -0800 Subject: [PATCH 7/8] Upload ubuntu --- .github/workflows/cli-tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cli-tests.yaml b/.github/workflows/cli-tests.yaml index dbd6cb4d7af..fac2f2a4586 100644 --- a/.github/workflows/cli-tests.yaml +++ b/.github/workflows/cli-tests.yaml @@ -71,6 +71,7 @@ jobs: - name: Publish to Cloudflare DNS # comment out for testing # if: github.event_name == 'schedule' && matrix.os == 'ubuntu-latest' # Only run on nightly builds for Ubuntu + if: matrix.os == 'ubuntu-latest' env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} CLOUDFLARE_DEV_JETIFY_COM_ZONE_ID: ${{ secrets.CLOUDFLARE_DEV_JETIFY_COM_ZONE_ID }} From 2460f63abd40577216f1a92a4dadccaffda2d306 Mon Sep 17 00:00:00 2001 From: Mike Landau Date: Tue, 4 Mar 2025 16:16:58 -0800 Subject: [PATCH 8/8] Uncomment if statement --- .github/workflows/cli-tests.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cli-tests.yaml b/.github/workflows/cli-tests.yaml index fac2f2a4586..ed6a93acabe 100644 --- a/.github/workflows/cli-tests.yaml +++ b/.github/workflows/cli-tests.yaml @@ -70,8 +70,7 @@ jobs: retention-days: 7 - name: Publish to Cloudflare DNS # comment out for testing - # if: github.event_name == 'schedule' && matrix.os == 'ubuntu-latest' # Only run on nightly builds for Ubuntu - if: matrix.os == 'ubuntu-latest' + if: github.event_name == 'schedule' && matrix.os == 'ubuntu-latest' # Only run on nightly builds for Ubuntu env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} CLOUDFLARE_DEV_JETIFY_COM_ZONE_ID: ${{ secrets.CLOUDFLARE_DEV_JETIFY_COM_ZONE_ID }}