|
| 1 | +# Simple workflow for deploying static content to GitHub Pages |
| 2 | +name: Deploy static content to Pages |
| 3 | + |
| 4 | +on: |
| 5 | + # Runs on pushes targeting the default branch |
| 6 | + push: |
| 7 | + branches: ["main"] |
| 8 | + |
| 9 | + # Allows you to run this workflow manually from the Actions tab |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + pages: write |
| 16 | + id-token: write |
| 17 | + |
| 18 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 19 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 20 | +concurrency: |
| 21 | + group: "pages" |
| 22 | + cancel-in-progress: false |
| 23 | + |
| 24 | +jobs: |
| 25 | + # Single deploy job since we're just deploying |
| 26 | + deploy: |
| 27 | + environment: |
| 28 | + name: github-pages |
| 29 | + url: ${{ steps.deployment.outputs.page_url }} |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - name: Update submodules |
| 33 | + run: | |
| 34 | + git clone -b release/documentation --single-branch --depth 1 https://git:${{ secrets.SRC_TOKEN }}@github.com/veracity-engineering/WebAppTemplate.git docs/articles |
| 35 | + |
| 36 | + git clone -b gh-pages --single-branch --depth 1 --depth 1 https://github.com/veracity-engineering/WebAppTemplateDoc.git docs/_site |
| 37 | + |
| 38 | + - name: Use Node |
| 39 | + uses: actions/setup-node@v3 |
| 40 | + with: |
| 41 | + node-version: '18.x' |
| 42 | + |
| 43 | + - name: Check files |
| 44 | + run: | |
| 45 | + ls |
| 46 | + cd docs/articles/website |
| 47 | + ls |
| 48 | + |
| 49 | + - name: Build artifacts |
| 50 | + run: | |
| 51 | + ls |
| 52 | + cd docs/articles/website |
| 53 | + echo "::debug::Install npm packages" |
| 54 | + npm install --force |
| 55 | + npm run build-git |
| 56 | + - name: Moving files |
| 57 | + run: | |
| 58 | + cp -R docs/articles/website/build/* docs/_site/ |
| 59 | + |
| 60 | + - name: Push to branch |
| 61 | + run: | |
| 62 | + cd docs/_site |
| 63 | + echo "::debug::Add new files to git" |
| 64 | + git fetch |
| 65 | + git add . |
| 66 | + echo "::debug::Commit changes to git" |
| 67 | + git config user.email "actions-bot@users.noreply.github.com" |
| 68 | + git config user.name "github actions bot" |
| 69 | + git commit -m "Update docs" || echo "No change to commit" |
| 70 | +
|
| 71 | + echo "::debug::Push commit to remote" |
| 72 | + git push -f https://git:${{ secrets.SRC_TOKEN }}@github.com/veracity-engineering/WebAppTemplateDoc.git HEAD:gh-pages |
| 73 | +
|
| 74 | + |
| 75 | + |
| 76 | +# - name: Publish pages |
| 77 | +# env: |
| 78 | +# SRC_FOLDER_PATH: 'docs/articles/website/docs' |
| 79 | +# TARGET_BRANCH: 'gh-pages' |
| 80 | +# run: | |
| 81 | +# ls |
| 82 | +# files=$(find $SRC_FOLDER_PATH -type f) # get the file list |
| 83 | +# git config --global user.name 'GitHub Action' |
| 84 | +# git config --global user.email 'action@github.com' |
| 85 | +# git fetch # fetch branches |
| 86 | +# git checkout $TARGET_BRANCH # checkout to your branch |
| 87 | +# git checkout ${GITHUB_REF##*/} -- $files # copy files from the source branch |
| 88 | +# git add -A |
| 89 | +# git diff-index --quiet HEAD || git commit -am "deploy files" # commit to the repository (ignore if no modification) |
| 90 | +# git push origin $TARGET_BRANCH # push to remote branch |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | +# - name: Publish gh-pages |
| 96 | +# run: | |
| 97 | +# #cd docs/articles/website |
| 98 | +# #ls |
| 99 | +# cd docs/_site |
| 100 | + |
| 101 | +# echo "::debug::Add new files to git" |
| 102 | +# git fetch |
| 103 | +# git add . |
| 104 | + |
| 105 | +# echo "::debug::Commit changes to git" |
| 106 | +# git config user.email "actions-bot@users.noreply.github.com" |
| 107 | +# git config user.name "github actions bot" |
| 108 | +# git commit -m "Update docs" || echo "No change to commit" |
| 109 | + |
| 110 | +# echo "::debug::Push commit to remote" |
| 111 | +# git push https://git:${{ secrets.SRC_TOKEN }}@github.com/veracity-engineering/WebAppTemplateDoc.git HEAD:gh-pages |
0 commit comments