Upgrade to Java 21 #131
Workflow file for this run
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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: CI CD | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [22.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '21' | |
distribution: 'adopt' | |
cache: maven | |
- name: Generate parser source code | |
run: npm run gen-parser | |
- run: npm ci | |
- run: npm test | |
- name: Builds the app for production | |
run: npm run build | |
- name: Upload production build | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build | |
if-no-files-found: error | |
path: build | |
retention-days: 1 | |
integration-test: | |
needs: [ build ] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ macos-latest, windows-latest ] | |
browser: [ chrome ] | |
include: | |
- os: windows-latest | |
browser: edge | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js 22.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 22.x | |
- name: Download production build | |
uses: actions/download-artifact@v2 | |
with: | |
name: build | |
path: build | |
- name: integration test | |
uses: cypress-io/github-action@v2 | |
with: | |
start: npm run start:ci | |
browser: ${{ matrix.browser }} | |
deploy: | |
if: ${{ github.event_name == 'release' }} | |
needs: [ integration-test ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download production build | |
uses: actions/download-artifact@v2 | |
with: | |
name: build | |
path: build | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: build | |
- name: Checkout my GitHub Page | |
uses: actions/checkout@v2 | |
with: | |
repository: ZengLawrence/ZengLawrence.github.io | |
ref: main | |
token: ${{ secrets.MY_GITHUB_PAGE_PAT }} | |
path: github-page | |
- name: Display structure of my GitHub Page | |
run: ls -R | |
working-directory: github-page | |
- name: Remove diet-diary dir | |
run: git rm -r diet-diary/ | |
working-directory: github-page | |
- name: Copy build dir to diet-diary dir | |
run: cp -r ../build/ diet-diary | |
working-directory: github-page | |
- name: Publish to my GitHub page | |
run: | | |
git add --all | |
git diff --stat | |
git config user.name Lawrence Zeng | |
git config user.email [email protected] | |
git commit -m "Production release of Diet Diary ${{ github.ref }}" | |
git push | |
working-directory: github-page |