Skip to content

Commit

Permalink
fix: Repair proxy and remove gh-pages deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
richtera committed Mar 30, 2023
1 parent a55f557 commit a783069
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,3 @@ jobs:
-e 's#https://storage.googleapis.com/lks-lz-binaries-euw4#https://storage.googleapis.com/lks-lz-binaries-euw4${{ needs.release_please.outputs.folder }}#g' \
-e 's#__VERSION__#${{ needs.release_please.outputs.version_name }}#g' \
install/install.sh > dist/index.html
- name: Deploy to Github pages
uses: JamesIves/github-pages-deploy-action@v4
if: ${{ needs.release_please.outputs.release_created == 'true' }}
with:
folder: ./dist
clean-exclude: pr-preview/

- name: Deploy PR to Github pages
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./dist
8 changes: 0 additions & 8 deletions .github/workflows/remove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,3 @@ jobs:
run: |-
gcloud auth login --brief --cred-file="${{ steps.gcpauth.outputs.credentials_file_path }}"
gsutil -m rm -r -f ./bucket/${{ github.event.number }}/*
# NEW CODE TO CLEANUP OLD GH_PAGES
- name: Create dir
run: mkdir -p ./dist
- name: Deploy PR
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./dist
8 changes: 6 additions & 2 deletions install/cf-wrangler/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ const cors = {
export default {
async fetch(request) {
const url = new URL(request.url);
const match = /^\/?(l?\d*)?\/?$/.exec(url.pathname);
const match = /^\/?(\d*|preview|l16)?\/?$/.exec(url.pathname);
if (match) {
const pr = match[1];
const proxyRequest = await fetch(`https://storage.googleapis.com/lks-lz-binaries-euw4${pr ? `/${pr}/install.sh` : '/install.sh'}`);
const url = `https://storage.googleapis.com/lks-lz-binaries-euw4${
pr ? `/${pr}/install.sh` : "/install.sh"
}`;
const proxyRequest = await fetch(url);
if (proxyRequest.status !== 200) {
console.error("error", proxyRequest, url);
return new Response(proxyRequest.statusTest, {
status: proxyRequest.status,
headers: cors,
Expand Down

0 comments on commit a783069

Please sign in to comment.