Skip to content

Commit

Permalink
Roi/dev/actions (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
roi-amaler-starkware authored Oct 25, 2022
1 parent 4845a3e commit b5fab24
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 5 deletions.
72 changes: 68 additions & 4 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,73 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 16

# - name: Install Antora and the Antora Lunr Extension
# run: npm i antora @antora/[email protected]
- name: Install node_modules
run: yarn

- name: Generate Site
run: npx antora playbook.yml
run: yarn generate

- name: "Upload generated content"
uses: actions/upload-artifact@v2
with:
name: starknet-site
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:
ref: gh-pages
github_token: ${{ secrets.USER_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: starknet-site
path: ${{ steps.pr.outputs.PR_ID }}

- name: PR preview details
run:
echo "you can preview the PR at https://starknet-community-libs.github.io/starknet-docs/${{ steps.pr.outputs.PR_ID }}/documentation/"

- 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.USER_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-community-libs.github.io/starknet-docs/${{ steps.pr.outputs.PR_ID }}/documentation/ ." >/tmp/comment
gh pr comment ${{ github.event.pull_request.number }} -F /tmp/comment
env:
GITHUB_TOKEN: "${{ secrets.USER_TOKEN }}"
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"pre-release": "standard-version --prerelease --skip.changelog --releaseCommitMessageFormat 'chore(prerelease): {{currentTag}}'",
"release": "standard-version",
"release:dry": "standard-version --dry-run"
"release:dry": "standard-version --dry-run",
"generate": "antora playbook.yml"
},
"devDependencies": {
"@antora/cli": "3.1.1",
Expand Down

0 comments on commit b5fab24

Please sign in to comment.