Skip to content

Update deploy.yml

Update deploy.yml #40

Workflow file for this run

name: Deploy to Firebase Hosting on Push
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Create package.json if it doesn't exist
run: |
if [ ! -f package.json ]; then
cat <<EOF > package.json
{
"name": "madj101",

Check failure on line 26 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/deploy.yml

Invalid workflow file

You have an error in your yaml syntax on line 26
"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": {
}
"author": "Raydo Matthee",
"license": "ISC",
"dependencies": {
"webpack": "^5.0.0",
"webpack-cli": "^4.0.0"
}
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-loader": "^8.0.0"
}
}
EOF
fi
- name: Create webpack.config.js if it doesn't exist
run: |
if [ ! -f webpack.config.js ]; then
cat <<EOF > webpack.config.js
const path = require("path");
module.exports = {
entry: "./web-portal/js/scripts.js",
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "web-portal/js")
},
mode: "production",
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"]
EOF
fi
- name: Install dependencies
run: |
if [ -f package-lock.json ]; then
npm ci
else
npm install
fi
- name: Build project
run: npm run build
- name: Deploy to Firebase Hosting
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_COURSE_MADJ101 }}
projectId: course-madj101
channelId: live