From cb18c731a4c80030151f67dfdf1d63e1271a9f22 Mon Sep 17 00:00:00 2001 From: lukqw Date: Tue, 3 Dec 2024 13:23:00 +0100 Subject: [PATCH 1/5] debug eph inst script --- .github/workflows/ephemeral.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ephemeral.yml b/.github/workflows/ephemeral.yml index 3aaa204..1c52304 100644 --- a/.github/workflows/ephemeral.yml +++ b/.github/workflows/ephemeral.yml @@ -39,7 +39,9 @@ jobs: - name: Run Ephemeral Script and Capture Output run: | pip3 install localstack - OUTPUT=$(bash bin/ephemeral.sh 2>&1) + bash bin/ephemeral.sh 2>&1 | tee output.log + + OUTPUT=$(cat output.log) echo "$OUTPUT" NEW_URL=$(echo "$OUTPUT" | grep -Eo 'https://ls-[^ ]+') From 732adf32a8616902e2b866ddabea73a54d39898e Mon Sep 17 00:00:00 2001 From: lukqw Date: Tue, 3 Dec 2024 13:30:23 +0100 Subject: [PATCH 2/5] tmp test ephemeral shell script --- .github/workflows/ephemeral.yml | 37 ++------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ephemeral.yml b/.github/workflows/ephemeral.yml index 1c52304..600695e 100644 --- a/.github/workflows/ephemeral.yml +++ b/.github/workflows/ephemeral.yml @@ -4,6 +4,8 @@ on: schedule: - cron: '0 * * * *' workflow_dispatch: + pull_request: + types: [opened, synchronize, reopened] permissions: contents: write @@ -55,38 +57,3 @@ jobs: echo "NEW_URL=$NEW_URL" >> $GITHUB_ENV env: LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} - - - name: Generate index.html with New Redirect URL - run: | - NEW_URL="${{ env.NEW_URL }}" - - # Validate the URL - if [[ ! "$NEW_URL" =~ ^https?:// ]]; then - echo "Error: Invalid URL provided." - exit 1 - fi - - echo "Redirecting to: $NEW_URL" - - cat > index.html < - - - - - Redirecting... - - -

If you are not redirected automatically, follow this link.

- - - EOL - - - name: Switch to gh-pages Branch and Commit Changes - run: | - git fetch origin gh-pages || echo "gh-pages branch does not exist; creating it." - git checkout gh-pages || git checkout --orphan gh-pages - git rm -rf . # Remove all files in the branch - git add index.html - git commit -m "Update redirect to ${NEW_URL}" - git push origin gh-pages --force From 3514659559e4b6aca1e413034ddf65daa190274d Mon Sep 17 00:00:00 2001 From: lukqw Date: Tue, 3 Dec 2024 13:36:12 +0100 Subject: [PATCH 3/5] remove echo statement on output as its now output --- .github/workflows/ephemeral.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ephemeral.yml b/.github/workflows/ephemeral.yml index 600695e..7f5c804 100644 --- a/.github/workflows/ephemeral.yml +++ b/.github/workflows/ephemeral.yml @@ -44,7 +44,6 @@ jobs: bash bin/ephemeral.sh 2>&1 | tee output.log OUTPUT=$(cat output.log) - echo "$OUTPUT" NEW_URL=$(echo "$OUTPUT" | grep -Eo 'https://ls-[^ ]+') if [ -z "$NEW_URL" ]; then From 97f3b5cec3ac70a6b8fda6edfa0a69bd65e26769 Mon Sep 17 00:00:00 2001 From: lukqw Date: Tue, 3 Dec 2024 13:42:13 +0100 Subject: [PATCH 4/5] readd steps --- .github/workflows/ephemeral.yml | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/ephemeral.yml b/.github/workflows/ephemeral.yml index 7f5c804..6ff2682 100644 --- a/.github/workflows/ephemeral.yml +++ b/.github/workflows/ephemeral.yml @@ -56,3 +56,37 @@ jobs: echo "NEW_URL=$NEW_URL" >> $GITHUB_ENV env: LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} + + - name: Generate index.html with New Redirect URL + run: | + NEW_URL="${{ env.NEW_URL }}" + + # Validate the URL + if [[ ! "$NEW_URL" =~ ^https?:// ]]; then + echo "Error: Invalid URL provided." + exit 1 + fi + + echo "Redirecting to: $NEW_URL" + + cat > index.html < + + + + + Redirecting... + + +

If you are not redirected automatically, follow this link.

+ + + EOL + - name: Switch to gh-pages Branch and Commit Changes + run: | + git fetch origin gh-pages || echo "gh-pages branch does not exist; creating it." + git checkout gh-pages || git checkout --orphan gh-pages + git rm -rf . # Remove all files in the branch + git add index.html + git commit -m "Update redirect to ${NEW_URL}" + git push origin gh-pages --force \ No newline at end of file From cc01a5f6c9670e04a13f63ad1f90cfb197762305 Mon Sep 17 00:00:00 2001 From: lukqw Date: Tue, 3 Dec 2024 13:42:23 +0100 Subject: [PATCH 5/5] readd stuff --- .github/workflows/ephemeral.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ephemeral.yml b/.github/workflows/ephemeral.yml index 6ff2682..2108527 100644 --- a/.github/workflows/ephemeral.yml +++ b/.github/workflows/ephemeral.yml @@ -4,8 +4,6 @@ on: schedule: - cron: '0 * * * *' workflow_dispatch: - pull_request: - types: [opened, synchronize, reopened] permissions: contents: write