-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,21 +2,27 @@ | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
|
||
name: Zalo Mini App | ||
run-name: ${{ github.event_name == 'schedule' && '✨ Refresh token' || '🚀 Deploy' }} | ||
|
||
concurrency: zalo-mini-app | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
branches: | ||
- main | ||
- "feat/**" | ||
pull_request: | ||
branches: ["main"] | ||
branches: | ||
- main | ||
- "feat/**" | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
deploy: | ||
refresh_token: | ||
if: ${{ github.event_name == 'schedule' }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
mini-app-id: ["194839900003483517"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js 18.x | ||
|
@@ -25,14 +31,40 @@ jobs: | |
node-version: 18.x | ||
cache: "npm" | ||
- run: npx zmp-developer-token login ${{ secrets.ZALO_APP_ID }} ${{ secrets.ZALO_APP_SECRET }} ${{ secrets.ZALO_REFRESH_TOKEN }} >> $GITHUB_ENV | ||
- uses: hmanzur/[email protected] | ||
with: | ||
name: "ZALO_ACCESS_TOKEN" | ||
value: ${{ env.NEW_ACCESS_TOKEN }} | ||
token: ${{ secrets.REPO_ACCESS_TOKEN }} | ||
- uses: hmanzur/[email protected] | ||
with: | ||
name: "ZALO_REFRESH_TOKEN" | ||
value: ${{ env.NEW_REFRESH_TOKEN }} | ||
token: ${{ secrets.REPO_ACCESS_TOKEN }} | ||
- name: Report | ||
run: | | ||
echo "### Token renewal success! :sparkles:" >> $GITHUB_STEP_SUMMARY | ||
deploy: | ||
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
mini-app-id: ["194839900003483517"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js 18.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
cache: "npm" | ||
- run: npm install | ||
- run: npm install -g zmp-cli | ||
- run: npx zmp-developer-token deploy ${{ matrix.mini-app-id }} | ||
env: | ||
NEW_ACCESS_TOKEN: ${{ secrets.ZALO_ACCESS_TOKEN }} | ||
- name: Report | ||
run: | | ||
echo "### Deployment success! :rocket:" >> $GITHUB_STEP_SUMMARY | ||
|