Files
OpenMQTTGateway/.github/workflows/release.yml
h2zero 2601d72017 Add uploading from documentation option. (#1048)
This allows for directly uploading OMG to ESP32 and ESp8266 devices from the upload section of the documentation.

This will upload the latest release binary for the device selected in the dropdown menu on the webpage.

A script has been added to generate the upload page when a new release is issued.
2021-08-02 15:50:19 -05:00

73 lines
2.3 KiB
YAML

name: Release
on:
release:
types: [published]
jobs:
build-upload:
runs-on: ubuntu-latest
name: Build and upload Assets to Release
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Install platformio
run: |
python -m pip install --upgrade pip
pip install platformio
- name: Set version tag from git
run: sed -i "s/version_tag/${GITHUB_REF#refs/tags/}/g" main/User_config.h
- name: Run PlatformIO
run: platformio run
- name: Prepare Release Assets
run: |
sudo apt install rename
./scripts/prepare_deploy.sh
- name: Get upload url
id: release-id
run: |
RELEASE_ID=$(jq --raw-output '.release.id' $GITHUB_EVENT_PATH)
echo "::set-output name=upload_url::https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets{?name,label}"
- name: Upload Release Assets
uses: bgpat/release-asset-action@03b0c30db1c4031ce3474740b0e4275cd7e126a3
with:
pattern: "toDeploy/*"
github-token: ${{ secrets.GITHUB_TOKEN }}
release-url: ${{ steps.release-id.outputs.upload_url }}
allow-overwrite: true
documentation:
needs: build-upload
runs-on: ubuntu-latest
name: Create the documentation and deploy it to GitHub Pages
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: "14.x"
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install requests
npm install
- name: Set version tag from git
run: sed -i "s/version_tag/${GITHUB_REF#refs/tags/}/g" docs/.vuepress/config.js
- name: Build documentation
run: |
python ./scripts/gen_wu.py ${GITHUB_REPOSITORY}
npm run docs:build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/.vuepress/dist
cname: docs.openmqttgateway.com