diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 3c1e2ff..95194e0 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,109 +1,38 @@ -name: Build and Test +name: Build and Deploy on: push: branches: - main - pull_request: - branches: - - main jobs: - build-and-test: + build-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v3 with: node-version: '20' - - name: Create package.json if not exists - 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" - }, - "author": "Raydo Matthee", - "license": "ISC", - "dependencies": {} - }' > package.json - fi - - name: Install dependencies - run: npm install - - - name: Verify HTML, CSS, and JavaScript run: | - npx html-validate web-portal/index.html - npx stylelint "web-portal/css/**/*.css" - npx eslint web-portal/js/**/*.js - - - name: Create quiz page - run: | - echo ' - - - - - Quiz - - - - -
-

Course Quiz

-
-
-
-
-

Question 1

-

What is the purpose of an MVP?

- A. To develop a full-featured product
- B. To gather early feedback
- C. To avoid user testing
-

Question 2

-

Which tool is used for version control?

- Git
- Docker
- Jenkins
- -
-
-
- - - - - - -' > web-portal/quiz.html + if [ -f package-lock.json ]; then + npm ci + else + npm install + fi - - name: Upload build artifacts - uses: actions/upload-artifact@v3 - with: - name: build-artifacts - path: web-portal + - name: Build project + run: npm run build - - name: Collect and upload logs - run: | - mkdir -p logs - cp ~/.npm/_logs/*.log logs/ - uses: actions/upload-artifact@v3 + - name: Deploy to Firebase Hosting + uses: FirebaseExtended/action-hosting-deploy@v0 with: - name: logs - path: logs - - - name: Notify failure - if: failure() - run: echo "Build or setup failed. Please check the logs for more details." + repoToken: ${{ secrets.GITHUB_TOKEN }} + firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} + projectId: course-madj101 + channelId: live \ No newline at end of file diff --git a/.github/workflows/setup-environment.yml b/.github/workflows/setup-environment.yml index 1ce49c9..37b94ed 100644 --- a/.github/workflows/setup-environment.yml +++ b/.github/workflows/setup-environment.yml @@ -1,6 +1,9 @@ name: Setup Environment -on: [push] +on: + push: + branches: + - main jobs: setup-environment: @@ -8,7 +11,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v3 @@ -38,7 +41,6 @@ jobs: echo "# Exercises" > course-materials/exercises/README.md echo "# Resources" > course-materials/resources/README.md echo "# Practical Lab Work" > practical-lab-work/README.md - echo ' @@ -156,7 +158,7 @@ footer { echo '// Firebase configuration const firebaseConfig = { - apiKey: "AIzaSyBkynA5-7Ir9ULqzYsAFEZXvK0717kTub0", + apiKey: "${{ secrets.AISTUDIO_API_KEY }}", authDomain: "course-madj101.firebaseapp.com", projectId: "course-madj101", storageBucket: "course-madj101.appspot.com", @@ -245,3 +247,15 @@ function submitQuiz() { alert("No user logged in!"); } }' > web-portal/js/scripts.js + + - name: Create quiz page + run: | + echo ' + + + + + Quiz + + +