Skip to content

✨ Refresh token

✨ Refresh token #60

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# 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
- "feat/**"
pull_request:
branches:
- main
- "feat/**"
schedule:
- cron: "0 0 * * *"
jobs:
refresh_token:
if: ${{ github.event_name == 'schedule' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
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
echo "" >> $GITHUB_STEP_SUMMARY # this is a blank line
echo "View your deployment result: [Version Management](https://mini.zalo.me/miniapp/${{ matrix.mini-app-id }}/versions)" >> $GITHUB_STEP_SUMMARY