Skip to content

Commit

Permalink
Merge pull request #3 from stu01509/task/migrate-jest
Browse files Browse the repository at this point in the history
chore: migrate to yarn package
  • Loading branch information
stu01509 authored Oct 26, 2023
2 parents 421df09 + 3722c6c commit cc8262f
Show file tree
Hide file tree
Showing 10 changed files with 5,168 additions and 10,805 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
- pull_request

jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18.12.1', '20.9.0']

steps:
- uses: actions/checkout@v4

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Init - Set up yarn environment
run: npm install -g yarn

- name: Install dependencies
run: yarn

- name: Unit Test
run: yarn test
123 changes: 61 additions & 62 deletions .github/workflows/main_etf-line-bot.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,61 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy Node.js app to Azure Web App - etf-line-bot

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js version
uses: actions/setup-node@v1
with:
node-version: '18.x'

- name: npm install, build, and test
run: |
npm install
npm run build --if-present
npm run test --if-present
- name: Zip artifact for deployment
run: zip release.zip ./* -r

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: node-app
path: release.zip

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: node-app

- name: Unzip artifact for deployment
run: unzip release.zip

- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'etf-line-bot'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_69620577D475481FA141DECD2BE9F697 }}
package: .
name: Build and deploy Node.js app to Azure Web App - etf-line-bot

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Init - Set up yarn environment
run: npm install -g yarn

- name: Install dependencies
run: yarn

- name: Unit Test
run: yarn test

- name: Zip artifact for deployment
run: zip release.zip ./* -r

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: node-app
path: release.zip

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: node-app

- name: Unzip artifact for deployment
run: unzip release.zip

- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'etf-line-bot'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_69620577D475481FA141DECD2BE9F697 }}
package: .
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/hydrogen
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ QR Code:
```Shell
$ git clone git@github.com:stu01509/ETF-Line-Bot.git
$ cd ETF-Line-Bot
$ npm install
$ yarn

```

Expand All @@ -76,7 +76,7 @@ DB_PATH = DB_ADDRESS # MongoDB 連線位置
### 啟動

```Shell
$ npm run start
$ yarn start
```

![Start](./assets/start.gif)
Loading

0 comments on commit cc8262f

Please sign in to comment.