Update runner command in deploy.yml #6
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 to GitHub Pages | |
on: | |
push: | |
branches: | |
- development | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
manager: ${{ steps.detect-package-manager.outputs.manager }} | |
command: ${{ steps.detect-package-manager.outputs.command }} | |
runner: ${{ steps.detect-package-manager.outputs.runner }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Detect package manager | |
id: detect-package-manager | |
run: | | |
if [ -f "yarn.lock" ]; then | |
echo "manager=yarn" >> $GITHUB_ENV | |
echo "command=install" >> $GITHUB_ENV | |
echo "runner=yarn" >> $GITHUB_ENV | |
echo "::set-output name=manager::yarn" | |
echo "::set-output name=command::install" | |
echo "::set-output name=runner::yarn" | |
elif [ -f "package.json" ]; then | |
echo "manager=npm" >> $GITHUB_ENV | |
echo "command=ci" >> $GITHUB_ENV | |
echo "runner=npm run" >> $GITHUB_ENV | |
echo "::set-output name=manager::npm" | |
echo "::set-output name=command::ci" | |
echo "::set-output name=runner::npx --no-install" | |
else | |
echo "Unable to determine package manager" | |
exit 1 | |
fi | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
cache: ${{ steps.detect-package-manager.outputs.manager }} | |
- name: Install npm at specific version | |
run: npm install -g npm@latest | |
- name: Install dependencies | |
run: ${{ env.manager }} ${{ env.command }} | |
- name: Build project | |
run: ${{ env.runner }} build | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: ./build | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v3 |