[.github/workflows/main.yml] Fix target domain ; only run tasks on pu… #81
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: GitHub Pages | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js LTS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Prepare and deploy | |
env: | |
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }} | |
GH_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }} | |
DIST: 'dist/offscale-www' | |
TARGET: 'offscale/offscale.github.io' | |
CNAME: 'offscale.io' | |
run: | | |
npm i -g npm | |
npm i -g @angular/cli typescript angular-cli-ghpages | |
ng add --skip-confirmation angular-cli-ghpages | |
npm ci | |
MSG="$(git show -s --format='%s' "$GITHUB_SHA")" | |
email_author="$(git log -1 --pretty=format:'%an <%ce>')" | |
author="${email_author% *}" | |
git config --global user.name "$author" | |
email="${email_author#*<}"; email="${email::-1}" | |
git config --global user.email "$email" | |
ng build --configuration production --base-href 'https://'"$CNAME" | |
head -n6 README.md > "$DIST"'/README.md' | |
mv "$DIST"'/browser'/* "$DIST" | |
npx angular-cli-ghpages --dir="$DIST" --cname="$CNAME" --repo='https://'"$GITHUB_TOKEN"'@github.com/'"$TARGET" --branch='master' --message="$MSG" --name="$name" --email="$email" --no-silent | |