From a5d5d1617cc8dd6b488ee9e69182da53796d80f3 Mon Sep 17 00:00:00 2001 From: Steven Sherry Date: Mon, 6 Mar 2023 14:12:31 -0600 Subject: [PATCH 1/5] chore: Initial cloudflare publishing attempt --- .github/workflows/docs-preview.yml | 31 +++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 65d210e..2d9f0bc 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -4,14 +4,21 @@ on: push: branches: - '**' +permissions: + contents: read + deployments: write + id-token: write + +env: + SLUG: portals-ios-api-ref-${{ github.event.number }}-${{ github.run_id }} jobs: publish-preview-docs: runs-on: macos-12 timeout-minutes: 30 - env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + environment: + name: preview-${{ github.event.number }} + url: https://${{ env.SLUG }}.ionicpreview.com steps: - name: Setup Node uses: actions/setup-node@v1 @@ -19,11 +26,13 @@ jobs: node-version: 16.x - run: sudo xcode-select --switch /Applications/Xcode_14.0.app - uses: actions/checkout@v2 - - name: Install Vercel CLI - run: npm install -g vercel - - name: Pull Build Configuration - run: vercel pull --token ${{ secrets.VERCEL_TOKEN }} - - name: Build Vercel Package - run: vercel build - - name: Deploy Preview - run: vercel deploy --prebuilt --token ${{ secrets.VERCEL_TOKEN }} + - name: Vercel CLI + run: npm run build + - uses: aws-actions/configure-aws-credentials@v1 + with: + role-to-assume: arn:aws:iam::319312831725:role/github-docs + aws-region: us-east-1 + - name: Deploy + run: | + aws s3 sync public s3://ionic-docs/preview/${{ env.SLUG }}/ --exclude '*.html' --cache-control max-age=31536000 --only-show-errors + aws s3 sync public s3://ionic-docs/preview/${{ env.SLUG }}/ --exclude '*' --include '*.html' --cache-control max-age=60 --only-show-errors From db063f9cceb1470a9d1cf83a9baa8f7980fe46cb Mon Sep 17 00:00:00 2001 From: Steven Sherry Date: Mon, 6 Mar 2023 14:30:38 -0600 Subject: [PATCH 2/5] chore: Transform docs --- .github/workflows/docs-preview.yml | 11 +++++++---- .gitignore | 2 ++ package.json | 9 --------- 3 files changed, 9 insertions(+), 13 deletions(-) delete mode 100644 package.json diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 2d9f0bc..d3677e8 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -4,6 +4,7 @@ on: push: branches: - '**' + permissions: contents: read deployments: write @@ -26,13 +27,15 @@ jobs: node-version: 16.x - run: sudo xcode-select --switch /Applications/Xcode_14.0.app - uses: actions/checkout@v2 - - name: Vercel CLI - run: npm run build + - name: Build Docs + run: xcodebuild docbuild -scheme IonicPortals -derivedDataPath DerivedData -destination 'platform=iOS Simulator,name=iPhone 14' + - name: Transform Docs + run: $(xcrun --find docc) process-archive transform-for-static-hosting DerivedData/Build/Products/Debug-iphonesimulator/IonicPortals.doccarchive --hosting-base-path $SLUG --output-path docs - uses: aws-actions/configure-aws-credentials@v1 with: role-to-assume: arn:aws:iam::319312831725:role/github-docs aws-region: us-east-1 - name: Deploy run: | - aws s3 sync public s3://ionic-docs/preview/${{ env.SLUG }}/ --exclude '*.html' --cache-control max-age=31536000 --only-show-errors - aws s3 sync public s3://ionic-docs/preview/${{ env.SLUG }}/ --exclude '*' --include '*.html' --cache-control max-age=60 --only-show-errors + aws s3 sync docs 3://ionic-docs/preview/${{ env.SLUG }}/ --exclude '*.html' --cache-control max-age=31536000 --only-show-errors + aws s3 sync docs s3://ionic-docs/preview/${{ env.SLUG }}/ --exclude '*' --include '*.html' --cache-control max-age=60 --only-show-errors diff --git a/.gitignore b/.gitignore index 4b0cd95..78c3ef3 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,5 @@ yarn.lock # Vitals vitals/dist + +docs/ diff --git a/package.json b/package.json deleted file mode 100644 index e70a7df..0000000 --- a/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "ionic-portals-ios-docs", - "private": true, - "scripts": { - "build": "npm run build:docs && npm run build:transform", - "build:docs": "xcodebuild docbuild -scheme IonicPortals -derivedDataPath DerivedData -destination 'platform=iOS Simulator,name=iPhone 13'", - "build:transform": "mv DerivedData/Build/Products/Debug-iphonesimulator/IonicPortals.doccarchive public" - } -} From 9bc821644f43da1a2eb29a79d075eafbec936e1b Mon Sep 17 00:00:00 2001 From: Steven Sherry Date: Mon, 6 Mar 2023 14:33:48 -0600 Subject: [PATCH 3/5] chore: Fix aws s3 sync --- .github/workflows/docs-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index d3677e8..6b00afa 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -37,5 +37,5 @@ jobs: aws-region: us-east-1 - name: Deploy run: | - aws s3 sync docs 3://ionic-docs/preview/${{ env.SLUG }}/ --exclude '*.html' --cache-control max-age=31536000 --only-show-errors + aws s3 sync docs s3://ionic-docs/preview/${{ env.SLUG }}/ --exclude '*.html' --cache-control max-age=31536000 --only-show-errors aws s3 sync docs s3://ionic-docs/preview/${{ env.SLUG }}/ --exclude '*' --include '*.html' --cache-control max-age=60 --only-show-errors From 4aaa0f2721ae314d3e626887aeaa138f470e9cd0 Mon Sep 17 00:00:00 2001 From: Steven Sherry Date: Mon, 6 Mar 2023 14:43:21 -0600 Subject: [PATCH 4/5] chore: Only build and push docs on PR --- .github/workflows/docs-preview.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 6b00afa..65e35e1 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -1,9 +1,6 @@ name: Publish Docs Preview -on: - push: - branches: - - '**' +on: pull_request permissions: contents: read From f4693cd2e877c91d1e5f72ec5f5ca5780689f669 Mon Sep 17 00:00:00 2001 From: Steven Sherry Date: Mon, 6 Mar 2023 14:51:48 -0600 Subject: [PATCH 5/5] chore: Update hosting base path --- .github/workflows/docs-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 65e35e1..0414548 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -27,7 +27,7 @@ jobs: - name: Build Docs run: xcodebuild docbuild -scheme IonicPortals -derivedDataPath DerivedData -destination 'platform=iOS Simulator,name=iPhone 14' - name: Transform Docs - run: $(xcrun --find docc) process-archive transform-for-static-hosting DerivedData/Build/Products/Debug-iphonesimulator/IonicPortals.doccarchive --hosting-base-path $SLUG --output-path docs + run: $(xcrun --find docc) process-archive transform-for-static-hosting DerivedData/Build/Products/Debug-iphonesimulator/IonicPortals.doccarchive --hosting-base-path docs/portals-ios-api-ref --output-path docs - uses: aws-actions/configure-aws-credentials@v1 with: role-to-assume: arn:aws:iam::319312831725:role/github-docs