Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

fix: Moved _Setting up your environment_ to shared repo. #353

fix: Moved _Setting up your environment_ to shared repo.

fix: Moved _Setting up your environment_ to shared repo. #353

Workflow file for this run

name: Pull request workflow
on: pull_request
jobs:
test-deploy:
name: Test deploy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
node-version: 16
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install node_modules
run: yarn
- name: Generate Site
run: yarn generate
- name: "Upload generated content"
uses: actions/upload-artifact@v2
with:
name: starknetbook
if-no-files-found: error
path:
public_html
publish:
name: deploy-review
runs-on: ubuntu-latest
needs:
- test-deploy
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
node-version: 16
token: "${{ secrets.GITHUB_TOKEN }}"
- name: Extract PR details
id: pr
run: |
PR_ID=pr-${{ github.event.pull_request.number }}
PREVIEW_PATH=previews/${PR_ID}
echo "::set-output name=PR_ID::${PR_ID}"
- name: "Remove preview build directory"
run: rm -rf ${{ steps.pr.outputs.PR_ID }}
- name: "Create preview build directory"
run: mkdir -p ${{ steps.pr.outputs.PR_ID }}
- name: "Download generated content"
uses: actions/download-artifact@v2
with:
name: starknetbook
path: ${{ steps.pr.outputs.PR_ID }}
- name: PR preview details
run:
echo "you can preview the PR at https://starknet-io.github.io/starknetbook/${{ steps.pr.outputs.PR_ID }}"
- name: "Commit changes"
run: |
set -euo pipefail
git config user.name "GitHub Actions"
git config user.email [email protected]
git add .
if ! git diff-index --quiet HEAD --; then
git commit -m "Adding or updating preview build for PR ${{ steps.pr.outputs.PR_ID }}"
git push --set-upstream origin gh-pages
else
echo -e "No changes found."
fi
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: "Send comment to PR"
continue-on-error: true
run: |
set -euo pipefail
echo "Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknetbook/${{ steps.pr.outputs.PR_ID }} ." >/tmp/comment
gh pr comment ${{ github.event.pull_request.number }} -F /tmp/comment
env:
GH_TOKEN: "${{ github.token }}"