feat(web): add data collection policy #214
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
name: deploy web | |
on: | |
release: | |
types: | |
- published | |
pull_request: | |
paths: | |
- 'web/**' | |
workflow_dispatch: | |
jobs: | |
deploy_website: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: use node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: build | |
run: | | |
cd web | |
yarn && yarn build:online | |
# TODO: upload dist to oss | |
# - name: upload dist | |
# if: github.event_name == 'release' && !github.event.release.prerelease | |
# run: | | |
# cd web | |
# wget https://gosspublic.alicdn.com/ossutil/1.7.8/ossutil64 | |
# chmod 755 ./ossutil64 | |
# ./ossutil64 config -e https://oss-accelerate.aliyuncs.com -i ${{ secrets.ALI_OSS_ACCESSKEY_ID }} -k ${{ secrets.ALI_OSS_ACCESSKEY_SECRET }} -L CH | |
# ./ossutil64 cp -r dist/ oss://mqtt-client-emqx-com/ -u | |
# - name: refresh cdn cache | |
# if: github.event_name == 'release' && !github.event.release.prerelease | |
# uses: Swilder-M/refresh-ali-cdn@v1 | |
# with: | |
# access_key_id: ${{ secrets.ALI_OSS_ACCESSKEY_ID }} | |
# access_key_secret: ${{ secrets.ALI_OSS_ACCESSKEY_SECRET }} | |
# file_paths: http://mqtt-client.emqx.com/ | |
publish_docker: | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: use node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: build | |
run: | | |
cd web | |
yarn && yarn build:docker | |
- name: docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: emqx/mqttx-web | |
flavor: | | |
latest=${{ !github.event.release.prerelease }} | |
tags: | | |
type=ref,event=tag | |
- name: set up qemu | |
uses: docker/setup-qemu-action@v2 | |
- name: set up docker buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: login to docker hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./web | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} |