Merge pull request #972 from UC-Davis-molecular-computing/dev #89
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: github pages | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v3 | |
- name: Checkout gh-pages branch | |
uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
path: gh-pages-repo | |
- name: Setup Dart SDK Step 1 | |
run: sudo apt-get update | |
- name: Setup Dart SDK Step 2 | |
run: sudo apt-get install apt-transport-https | |
- name: Setup Dart SDK Step 3 | |
run: sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -' | |
- name: Setup Dart SDK Step 4 | |
run: sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list' | |
- name: Setup Dart SDK Step 5 | |
run: wget -O /tmp/dart_2.13.4-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/2.13.4/linux_packages/dart_2.13.4-1_amd64.deb | |
- name: Setup Dart SDK Step 6 | |
run: sudo apt install /tmp/dart_2.13.4-1_amd64.deb | |
- name: Install dependencies | |
run: PATH="$PATH:/usr/lib/dart/bin" pub get | |
- name: Install webdev | |
run: PATH="$PATH:/usr/lib/dart/bin" pub global activate webdev | |
- name: Build into gh-pages repo | |
run: PATH="$PATH:/usr/lib/dart/bin" pub global run webdev build -o web:/tmp/scadnano ; cp -r /tmp/scadnano/* gh-pages-repo | |
- name: Retrieve version | |
run: echo "VERSION=$(cat lib/src/constants.dart | grep 'const String CURRENT_VERSION = .*' | grep -oP '\d+\.\d+\.\d+')" >> $GITHUB_ENV | |
- name: Build into gh-pages-repo/VERSION | |
run: | | |
if [ "$VERSION" != "" ]; then | |
PATH="$PATH:/usr/lib/dart/bin" pub global run webdev build -o web:gh-pages-repo/v$VERSION | |
else | |
echo "::warning deploying VERSION skipped because VERSION number could not be found" | |
fi | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: gh-pages-repo |