diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index eebed4f0e..5df90ec1b 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -5,6 +5,8 @@ on: branches: - develop workflow_dispatch: + release: + types: [published] jobs: @@ -34,7 +36,8 @@ jobs: git config --global user.name "${COMMIT_AUTHOR}" git config --global user.email "${COMMIT_AUTHOR_EMAIL}" - - name: Commit to gh-pages + - name: Commit development version to gh-pages + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' run: | git fetch origin gh-pages git checkout gh-pages @@ -48,6 +51,22 @@ jobs: exit 0 fi + - name: Commit tagged version to gh-pages + if: github.event_name == 'release' + run: | + TAG=${{ github.event.release.tag_name }} + git fetch origin gh-pages + git checkout gh-pages + mkdir -p specification/${TAG} + mv optimade.html specification/${TAG}/index.html + git add specification/${TAG}/index.html + # Set latest symlink + rm specification/latest && ln -s specification/${TAG} specification/latest + git commit -m "Deploy ${TAG} specification to GitHub Pages: ${SHA}" + if git diff --cached --quiet; then + exit 0 + fi + - name: Push changes uses: ad-m/github-push-action@v0.8.0 with: