Deploy Docs #18
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
name: Deploy Docs | |
on: | |
workflow_run: | |
workflows: ["Publish to NPM"] | |
types: | |
- completed | |
workflow_dispatch: | |
jobs: | |
deploy: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "18" | |
- name: Obtain GitHub App Installation Access Token | |
id: githubAppAuth | |
run: | | |
TOKEN="$(npx obtain-github-app-installation-access-token ci ${{ secrets.GH_APP_CREDENTIALS_TOKEN_JWT }})" | |
echo "::add-mask::$TOKEN" | |
echo "::set-output name=token::$TOKEN" | |
- name: Use the obtained token | |
id: tokenEnv | |
run: | | |
curl -X POST -H 'Content-Type: application/json' \ | |
-d '{"context":"test","state":"success"}' \ | |
"https://api.github.com/repos/$GITHUB_REPOSITORY/statuses/$GITHUB_SHA?access_token=$GITHUB_TOKEN" | |
- name: Setup Auth ENV | |
env: | |
email: "developers@squidit.com.br" | |
username: "squidit" | |
run: | | |
git config --global credential.helper store | |
echo "https://${{ steps.githubAppAuth.outputs.token }}:x-oauth-basic@github.com" > ~/.git-credentials | |
git config --global user.email $email | |
git config --global user.name $username | |
- name: Deploy to gh-pages | |
run: | | |
npm install | |
npm run build:docs | |
rm -rf docs | |
mkdir docs | |
mv dist/docs/* docs/ | |
cd docs | |
echo "ngx-css.squidit.com.br" > CNAME | |
cd .. | |
echo "ngx-css.squidit.com.br" > CNAME | |
git init | |
git add -A | |
git commit -m "🚀 Deploy id ${GITHUB_RUN_ID}" --no-verify | |
git push -f "https://github.com/${GITHUB_REPOSITORY}.git" HEAD:gh-pages --no-verify |