From 1ac1dfa37fd07e876ae6ae7f058ad4ab6b12a1a4 Mon Sep 17 00:00:00 2001 From: soyuka Date: Thu, 16 Nov 2023 12:18:26 +0100 Subject: [PATCH] deploy to s3 --- .github/workflows/cd.yml | 66 +++++++++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 31288bc4286..05638536d24 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -4,16 +4,68 @@ on: push: branches: - main - - '[0-9]+.[0-9]+' + - '*.*' jobs: deploy: runs-on: ubuntu-latest steps: - - name: Trigger website workflow - uses: convictional/trigger-workflow-and-wait@v1.6.5 + - name: Checkout the website + uses: actions/checkout@v3 with: - owner: api-platform - repo: website - workflow_file_name: cd.yml - github_token: ${{ secrets.WEBSITE_ACCESS_TOKEN }} + repository: api-platform/website + ref: main + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT" + + - uses: actions/cache@v3 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: '0.119.0' + extended: true + + - run: | + git clone git@github.com:api-platform/docs-website + cd docs-website + npm install + # fetches api-platform/docs + bash tools/get-docs.sh + # fetches api-platform/core for reference and guides + bash tools/get-core-docs.sh + # builds the config/_default/menu.toml according to the outline.yaml from api-platform/docs + node tools/menu.mjs + # build our tailwind theme + hugo --minify + # env: + # GITHUB_KEY: ${{ secrets.CONTRIBUTORS_GITHUB_TOKEN }} + # NODE_OPTIONS: --openssl-legacy-provider + # run: yarn gatsby build + + # - name: Deploy + # uses: peaceiris/actions-gh-pages@v3 + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # publish_dir: ./public + # cname: api-platform.com + + - name: Auth gcloud + uses: google-github-actions/auth@v1 + with: + credentials_json: ${{ secrets.BUCKET_CREDS }} + + - name: 'Set up Cloud SDK' + uses: 'google-github-actions/setup-gcloud@v1' + + - name: Deploy on bucket + run: gsutil -m rsync -d -r ./public gs://api-platform-website-v3/