From 93484d71b6f24c7b1d341f7459b1416349747046 Mon Sep 17 00:00:00 2001 From: Ben Phelps Date: Fri, 29 Sep 2023 17:49:17 +0300 Subject: [PATCH] Update ci-docs.yml --- .github/workflows/ci-docs.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-docs.yml b/.github/workflows/ci-docs.yml index 2c5ca36a..0ba5f626 100644 --- a/.github/workflows/ci-docs.yml +++ b/.github/workflows/ci-docs.yml @@ -1,22 +1,19 @@ name: Homepage Docs Build & Deploy + on: push: tags: [ 'v*.*.*' ] branches: ['main'] workflow_dispatch: + permissions: contents: write + jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: Set Git config - run: | - git config --global user.name "GitHub Action" - git config --global user.email "action@github.com" - uses: actions/setup-python@v4 with: python-version: 3.x @@ -30,19 +27,21 @@ jobs: - run: sudo apt-get install pngquant - run: pip install mike - run: pip install git+https://${GH_TOKEN}@github.com/benphelps/mkdocs-material-insiders.git + - name: Set Git config + run: | + git config --global user.name "GitHub Action" + git config --global user.email "action@github.com" - name: Sync gh-pages run: | git fetch origin gh-pages git checkout gh-pages git pull origin gh-pages git checkout main - - name: Mike Deploy for Tags - if: github.ref != 'refs/heads/main' - run: | - git checkout main - mike deploy --push ${{github.ref_name}} latest - name: Mike Deploy for Main if: github.ref == 'refs/heads/main' - run: mike deploy --update --push main + run: mike deploy --update --push ${{github.ref_name}} + - name: Mike Deploy for Tags + if: github.ref != 'refs/heads/main' + run: mike deploy --push ${{github.ref_name}} latest env: GH_TOKEN: ${{ secrets.GH_TOKEN }}