Skip to content

[.github/workflows/main.yml] Set git author and email before upload; … #129

[.github/workflows/main.yml] Set git author and email before upload; …

[.github/workflows/main.yml] Set git author and email before upload; … #129

Workflow file for this run

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: 'build résumé PDF'
uses: dante-ev/latex-action@latest
with:
root_file: 'résumé/Samuel Marks.tex'
compiler: pdflatex
args: -interaction=nonstopmode -shell-escape
- name: 'upload résumé PDF'
run: |
gh release delete 'latest' -y || true
git push origin :refs/tags/latest || true
if ! git tag latest -m 'latest' ; then
git tag -d latest || true
git tag latest -m 'latest'
fi
git push --tags
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"
gh release create 'latest' 'Samuel Marks.pdf' --notes-from-tag
env:
GH_TOKEN: ${{ github.token }}
- name: Prepare and deploy
env:
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
DIST: 'dist/samuelmarks-github-io'
TARGET: 'SamuelMarks/SamuelMarks.github.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" --repo='https://'"$GITHUB_TOKEN"'@github.com/'"$TARGET" --branch='master' --message="$MSG" --name="$name" --email="$email" --no-silent