cc-mek-scada/.github/workflows/pages.yml

105 lines
3.8 KiB
YAML
Raw Normal View History

2023-06-08 14:46:35 +00:00
# Deploy installation manifests, shields versions, and documentation to GitHub Pages
2023-06-08 14:41:44 +00:00
name: Deploy Install Data and LuaDoc
2023-05-28 03:36:32 +00:00
on:
workflow_dispatch:
push:
branches:
- main
- latest
- devel
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Setup Python
uses: actions/setup-python@v3.1.3
# Generate manifest + shields files for main branch
- name: Checkout main
2023-06-07 19:28:49 +00:00
id: checkout-main
uses: actions/checkout@v3
with:
ref: 'main'
2023-06-07 20:04:39 +00:00
clean: false
- name: Create outputs folders
2023-06-07 20:07:12 +00:00
if: success() || failure()
2023-06-07 20:04:39 +00:00
shell: bash
run: mkdir deploy; mkdir deploy/manifests; mkdir deploy/manifests/main deploy/manifests/latest deploy/manifests/devel
2023-05-31 15:19:32 +00:00
- name: Generate manifest and shields for main branch
2023-06-07 19:28:49 +00:00
id: manifest-main
2023-06-07 20:07:12 +00:00
if: ${{ (success() || failure()) && steps.checkout-main.outcome == 'success' }}
run: python imgen.py shields
- name: Save main's manifest
2023-06-07 20:07:12 +00:00
if: ${{ (success() || failure()) && steps.manifest-main.outcome == 'success' }}
run: mv install_manifest.json deploy/manifests/main
2023-06-08 14:41:44 +00:00
- name: Generate LuaDoc
2023-06-08 14:58:06 +00:00
if: success() || failure()
2023-06-08 14:50:39 +00:00
uses: lunarmodules/ldoc@v1.5.0
2023-06-08 14:42:49 +00:00
with:
2023-06-08 14:58:06 +00:00
args: ./coordinator ./graphics ./pocket ./reactor-plc ./rtu ./scada-common ./supervisor
- name: Save doc directory
if: success() || failure()
shell: bash
run: mv doc deploy/
# Generate manifest for latest branch
- name: Checkout latest
2023-06-07 19:28:49 +00:00
id: checkout-latest
if: success() || failure()
uses: actions/checkout@v3
with:
ref: 'latest'
2023-06-07 20:04:39 +00:00
clean: false
- name: Generate manifest for latest
2023-06-07 19:28:49 +00:00
id: manifest-latest
2023-06-07 20:07:12 +00:00
if: ${{ (success() || failure()) && steps.checkout-latest.outcome == 'success' }}
run: python imgen.py
- name: Save latest's manifest
2023-06-07 20:07:12 +00:00
if: ${{ (success() || failure()) && steps.manifest-latest.outcome == 'success' }}
run: mv install_manifest.json deploy/manifests/latest
# Generate manifest for devel branch
- name: Checkout devel
2023-06-07 19:28:49 +00:00
id: checkout-devel
if: success() || failure()
uses: actions/checkout@v3
with:
ref: 'devel'
2023-06-07 20:04:39 +00:00
clean: false
- name: Generate manifest for devel
2023-06-07 19:28:49 +00:00
id: manifest-devel
2023-06-07 19:57:07 +00:00
if: ${{ (success() || failure()) && steps.checkout-devel.outcome == 'success' }}
2023-05-31 15:17:44 +00:00
run: python imgen.py
- name: Save devel's manifest
2023-06-07 19:57:07 +00:00
if: ${{ (success() || failure()) && steps.manifest-devel.outcome == 'success' }}
run: mv install_manifest.json deploy/manifests/devel
# All artifacts ready now, upload deploy directory
2023-05-31 15:15:55 +00:00
- name: Upload artifacts
2023-06-07 20:07:12 +00:00
id: upload-artifacts
if: ${{ (success() || failure()) && (steps.manifest-main.outcome == 'success' || steps.manifest-latest.outcome == 'success' || steps.manifest-devel.outcome == 'success') }}
2023-05-28 03:36:32 +00:00
uses: actions/upload-pages-artifact@v1
with:
# Upload manifest JSON
2023-05-31 15:15:55 +00:00
path: 'deploy/'
2023-05-28 03:36:32 +00:00
- name: Deploy to GitHub Pages
2023-06-07 20:07:12 +00:00
if: ${{ (success() || failure()) && steps.upload-artifacts.outcome == 'success' }}
2023-05-28 03:36:32 +00:00
id: deployment
uses: actions/deploy-pages@v2