Skip to content

Commit

Permalink
Update Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Oct 17, 2020
1 parent da07d04 commit a80ba14
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ jobs:
esac
- if: startsWith(matrix.os, 'ubuntu')
name: Publish Python Server
name: Publish Python
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_api_token }}
run: make publish_python

- if: startsWith(matrix.os, 'ubuntu')
name: Publish GitHub Pages
name: Publish Web
env:
GITHUB_TOKEN: ${{ secrets.PUBLISH_GITHUB_TOKEN }}
GITHUB_USER: ${{ secrets.PUBLISH_GITHUB_USER }}
run: make publish_github_pages
run: make publish_web

- if: startsWith(matrix.os, 'macos')
name: Publish cask
Expand Down
24 changes: 19 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

build: clean lint build_python build_electron

publish: clean lint publish_electron publish_python publish_github_pages publish_cask publish_winget
publish: clean lint publish_electron publish_python publish_web publish_cask publish_winget

install:
@[ -d node_modules ] || npm install
Expand Down Expand Up @@ -60,12 +60,26 @@ publish_electron: install
npx electron-builder --linux appimage --publish always
npx electron-builder --linux snap --publish always

publish_github_pages: build_python
build_web:
mkdir -p ./dist/web
rm -rf ./dist/web/*
cp -R ./source/*.html ./dist/web
cp -R ./source/*.css ./dist/web
cp -R ./source/*.js ./dist/web
cp -R ./source/*.json ./dist/web
cp -R ./source/*.ico ./dist/web
cp -R ./source/*.png ./dist/web
cp -R ./node_modules/d3/dist/d3.min.js ./dist/web
cp -R ./node_modules/dagre/dist/dagre.min.js ./dist/web
cp -R ./node_modules/marked/marked.min.js ./dist/web
cp -R ./node_modules/pako/dist/pako.min.js ./dist/web
rm -rf ./dist/web/electron.* ./dist/web/app.js
sed -i "s/0\.0\.0/$$(grep '"version":' package.json -m1 | cut -d\" -f4)/g" ./dist/web/index.html

publish_web: build_web
rm -rf ./dist/gh-pages
git clone --depth=1 https://x-access-token:$(GITHUB_TOKEN)@github.com/$(GITHUB_USER)/netron.git --branch gh-pages ./dist/gh-pages 2>&1 > /dev/null
rm -rf ./dist/gh-pages/*
cp -R ./dist/lib/netron/* ./dist/gh-pages/
rm -rf ./dist/gh-pages/*.py*
cp -R ./dist/web/* ./dist/gh-pages
git -C ./dist/gh-pages add --all
git -C ./dist/gh-pages commit --amend --no-edit
git -C ./dist/gh-pages push --force origin gh-pages
Expand Down

0 comments on commit a80ba14

Please sign in to comment.