fix: permissions issues #19
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 Angular to GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout togglight repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install | |
- name: Build Angular project | |
run: npx ng build --base-href "https://togglight.derveydylan.github.io/" --output-path=dist | |
- name: Clone derveydylan.github.io repository | |
run: | | |
git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/derveydylan/derveydylan.github.io.git ../derveydylan.github.io | |
ls -la ../ | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Copy build to derveydylan.github.io | |
run: | | |
rm -rf ../derveydylan.github.io/togglight | |
mkdir -p ../derveydylan.github.io/togglight | |
cp -r dist/* ../derveydylan.github.io/togglight | |
- name: Add CNAME file | |
run: echo "togglight.derveydylan.github.io" > ../derveydylan.github.io/togglight/CNAME | |
- name: Deploy to derveydylan.github.io | |
run: | | |
cd ../derveydylan.github.io | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add togglight | |
git commit -m "Deploy togglight" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |