From d2cb9509c3a82cd954e867accfee578d8a42795e Mon Sep 17 00:00:00 2001 From: Jamil Bou Kheir Date: Mon, 17 Jan 2022 21:20:28 -0800 Subject: [PATCH] Fix docs publishing --- .github/workflows/ci.yml | 47 +++++++++++++++++++++++++++++++++ .github/workflows/docs.yml | 54 -------------------------------------- 2 files changed, 47 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98db11835..d864b9a9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -195,3 +195,50 @@ jobs: files: | ./firezone*.rpm ./firezone*.deb + publish-docs: + needs: publish + if: startsWith(github.ref, 'refs/tags/') + runs-on: macos-11 + steps: + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Write tags manifest + run: | + echo ${{ steps.get_version.outputs.VERSION }} > docs/assets/versions.txt + tags=`git ls-tree --name-only origin/gh-pages | egrep "^((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)$"` + echo $tags | tr " " "\n" >> docs/assets/versions.txt + - name: Build jekyll site + run: | + cd docs/ + gem install bundler + bundle install + + # Generate top-level docs + bundle exec jekyll build \ + --destination _latest + + # Generate versioned docs + bundle exec jekyll build \ + --baseurl ${{ steps.get_version.outputs.VERSION }} \ + --destination ${{ steps.get_version.outputs.VERSION }} + - name: Publish Latest Docs + uses: JamesIves/github-pages-deploy-action@v4.2.2 + with: + branch: gh-pages + folder: docs/_latest + target-folder: . + clean: false + - name: Publish Versioned Docs + uses: JamesIves/github-pages-deploy-action@v4.2.2 + with: + branch: gh-pages + folder: docs/${{ steps.get_version.outputs.VERSION }} + target-folder: ${{ steps.get_version.outputs.VERSION }} + clean: false diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 1bd6c410e..000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: docs -on: - - push -defaults: - run: - shell: bash - -jobs: - publish-docs: - if: startsWith(github.ref, 'refs/tags/') - runs-on: macos-11 - steps: - - name: Get the version - id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - name: Write tags manifest - run: | - echo ${{ steps.get_version.outputs.VERSION }} > docs/assets/versions.txt - tags=`git ls-tree --name-only origin/gh-pages | egrep "^((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)$"` - echo $tags | tr " " "\n" >> docs/assets/versions.txt - - name: Build jekyll site - run: | - cd docs/ - gem install bundler - bundle install - - # Generate top-level docs - bundle exec jekyll build \ - --destination _latest - - # Generate versioned docs - bundle exec jekyll build \ - --baseurl ${{ steps.get_version.outputs.VERSION }} \ - --destination ${{ steps.get_version.outputs.VERSION }} - - name: Publish Latest Docs - uses: JamesIves/github-pages-deploy-action@v4.2.2 - with: - branch: gh-pages - folder: docs/_latest - target-folder: . - clean: false - - name: Publish Versioned Docs - uses: JamesIves/github-pages-deploy-action@v4.2.2 - with: - branch: gh-pages - folder: docs/${{ steps.get_version.outputs.VERSION }} - target-folder: ${{ steps.get_version.outputs.VERSION }} - clean: false