Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate to yarn package #3

Merged
merged 2 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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