generated from AdobeDocs/dev-site-documentation-template
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update GH pages workflows according to the GH sample (#140)
- Loading branch information
Showing
2 changed files
with
70 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Deploy Gatsby site to Pages | ||
|
||
on: workflow_call | ||
|
||
jobs: | ||
# Build job | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: yarn | ||
- name: Setup Pages | ||
id: pages | ||
uses: actions/configure-pages@v5 | ||
with: | ||
# Automatically inject pathPrefix in your Gatsby configuration file. | ||
# | ||
# You may remove this line if you want to manage the configuration yourself. | ||
static_site_generator: gatsby | ||
- name: Restore cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
public | ||
.cache | ||
key: ${{ runner.os }}-gatsby-build-${{ hashFiles('public') }} | ||
restore-keys: | | ||
${{ runner.os }}-gatsby-build- | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Build with Gatsby | ||
env: | ||
PREFIX_PATHS: 'true' | ||
run: yarn run build | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: ./public | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,20 @@ | ||
--- | ||
name: Github Pages | ||
name: Deploy Gatsby site to Pages | ||
|
||
on: workflow_dispatch | ||
permissions: {} | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Setup Node and Install Dependencies Action | ||
uses: commerce-docs/devsite-install-action@main | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache-dependency-path: 'yarn.lock' | ||
|
||
- name: Build site | ||
id: build | ||
run: yarn build | ||
env: | ||
NODE_OPTIONS: "--max-old-space-size=8192" | ||
PREFIX_PATHS: true # works like --prefix-paths flag for 'gatsby build' | ||
PATH_PREFIX: ${{ github.event.repository.name }} | ||
ADOBE_LAUNCH_SRC: ${{ secrets.AIO_ADOBE_LAUNCH_SRC }} | ||
ADOBE_LAUNCH_SRC_INCLUDE_IN_DEVELOPMENT: ${{ secrets.ADOBE_LAUNCH_SRC_INCLUDE_IN_DEVELOPMENT }} | ||
REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
REPO_OWNER: ${{ github.event.repository.owner.login }} | ||
REPO_NAME: ${{ github.event.repository.name }} | ||
REPO_BRANCH: ${{ github.ref_name }} | ||
GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }} | ||
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }} | ||
GOOGLE_DOCS_TOKEN: ${{ secrets.GOOGLE_DOCS_TOKEN }} | ||
GOOGLE_DOCS_FOLDER_ID: ${{ secrets.GOOGLE_DOCS_FOLDER_ID }} | ||
- name: Upload static files as artifact | ||
id: deployment | ||
uses: actions/upload-pages-artifact@v3 # or specific "vX.X.X" version tag for this action | ||
with: | ||
path: public | ||
# Deploy job | ||
deploy: | ||
# Add a dependency to the build job | ||
needs: build | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | ||
permissions: | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
# Deploy to the github-pages environment | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
# Specify runner + deployment step | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action | ||
jobs: | ||
call-workflow-deploy-to-pages: | ||
uses: AdobeDocs/commerce-php/.github/workflows/deploy-to-pages_job.yml@main |