Fix zip artefacts #54
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: NMSDK | |
on: | |
# Run on all branches except for the gh-pages branch | |
push: | |
branches-ignore: | |
- 'gh-pages' | |
pull_request: | |
branches-ignore: | |
- 'gh-pages' | |
create: | |
jobs: | |
build: | |
name: Build artefacts | |
runs-on: windows-latest | |
outputs: | |
nmsdk_version: ${{ steps.get_nmsdk_version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: python -m pip install flake8 mkdocs | |
# - name: Lint code | |
# run: flake8 . | |
- name: Build docs | |
run: mkdocs build | |
- name: Build release | |
run: | | |
python ./tools/build.py | |
dir | |
mkdir nmsdk | |
Expand-Archive build/nmsdk.zip -DestinationPath nmsdk | |
dir | |
cd nmsdk | |
dir | |
cd .. | |
- name: Get NMSDK tag version | |
id: get_nmsdk_version | |
run: echo "version=$(Tools/read_nmsdk_version.sh)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: list files | |
run: dir | |
- name: Upload plugin zip for release | |
uses: actions/upload-artifact@v4 | |
with: | |
name: NMSDK | |
path: nmsdk | |
- name: Upload website for release | |
uses: actions/upload-artifact@v4 | |
with: | |
name: NMSDK_site | |
path: html_docs/* | |
release: | |
name: Release NMSDK zip and publish docs | |
# Only run this job if the commit was tagged. | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
runs-on: windows-latest | |
needs: [build] | |
env: | |
VERSION: ${{ needs.build.outputs.nmsdk_version }} | |
steps: | |
- name: Download files for release | |
uses: actions/download-artifact@v3 | |
with: | |
name: NMSDK | |
- name: Get tagged version | |
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
shell: bash | |
- name: Upload resources if version matches | |
if: env.VERSION == env.TAG | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: "${{ env.TAG }}" | |
tag_name: ${{ env.TAG }} | |
prerelease: false | |
files: nmsdk.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# TODO: Also upload site. | |
- name: Check if tag doesn't match version | |
if: env.VERSION != env.TAG | |
run: | | |
echo "There is a version mismatch between the tag and NMSDK version!" | |
echo "NMSDK version: ${{ env.VERSION }}" | |
echo "Tag version: ${{ env.TAG }}" | |
exit 1 | |
shell: bash |