Skip to content

Merge pull request #34 from microsoft/test-updates-oct #23

Merge pull request #34 from microsoft/test-updates-oct

Merge pull request #34 from microsoft/test-updates-oct #23

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
- name: Clean dist directory
run: rm -rf ./code/dist
- name: Install dependencies
run: npm install
working-directory: ./code
- name: Build project
run: npm run build
working-directory: ./code
- name: Upload production-ready build files
uses: actions/upload-artifact@v4
with:
name: github-pages
path: ./code/dist
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: github-pages
path: ./code/dist
- name: Create CNAME file
run: echo accelerators.ms > ./code/dist/CNAME # Replace with your actual domain
- name: Deploy to GitHub Pages
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git init
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git fetch origin
git checkout -B gh-pages
mv ./code/dist/* ./ # Move the contents of dist to the root
git add .
git commit -m "Deploy to GitHub Pages"
git push origin gh-pages --force