Skip to content

Update firebase-hosting-merge.yml #3

Update firebase-hosting-merge.yml

Update firebase-hosting-merge.yml #3

# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools
name: Deploy to Firebase Hosting on PR
on: pull_request
permissions:
checks: write
contents: read
pull-requests: write
jobs:
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Create package.json if it doesn't exist
run: |
if [ ! -f package.json ]; then
echo '{
"name": "madj101",
"version": "1.0.0",
"description": "Mobile App Development for Juniors",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --config webpack.config.js"
},
"author": "Raydo Matthee",
"license": "ISC",
"dependencies": {
"webpack": "^5.0.0",
"webpack-cli": "^4.0.0"
}
}' > package.json
fi
- name: Create webpack.config.js if it doesn't exist
run: |
if [ ! -f webpack.config.js ]; then
echo 'const path = require("path");
module.exports = {

Check failure on line 48 in .github/workflows/firebase-hosting-pull-request.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/firebase-hosting-pull-request.yml

Invalid workflow file

You have an error in your yaml syntax on line 48
entry: "./web-portal/js/scripts.js",
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "web-portal/js")
},
mode: "production"
};' > webpack.config.js
fi
- name: Install dependencies
run: |
if [ -f package-lock.json ]; then
npm ci
else
npm install
fi
- name: Build project
run: npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_COURSE_MADJ101 }}
projectId: course-madj101