Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-johan-grahn committed Nov 16, 2024
1 parent 11b13d4 commit 4d6b520
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/pull_request_closed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ jobs:
token: ${{ secrets.GH_TOKEN }}

- name: Store the current head ref as a url friendly variable
id: current_branch
env:
HEAD_REF: ${{ github.head_ref }}
run: |
CURRENT_BRANCH=$(echo ${HEAD_REF} | sed -e 's/[]:@\/?&=#%+[\!$()*,;]/-/g')
url_friendly_branch=$(echo ${HEAD_REF} | sed -e 's/[]:@\/?&=#%+[\!$()*,;]/-/g')
echo "CURRENT_BRANCH=$(echo ${url_friendly_branch})" >> $GITHUB_OUTPUT
- name: Set up Python
uses: actions/setup-python@v5
Expand All @@ -44,7 +46,7 @@ jobs:
git config --local user.name "stakater-user"
- name: Delete redundant PR deployment
run: mike delete --push -b pull-request-deployments $CURRENT_BRANCH
run: mike delete --push -b pull-request-deployments ${{ steps.current_branch.outputs.CURRENT_BRANCH }}

- name: Comment on PR
uses: mshick/add-pr-comment@v2
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/pull_request_versioned_doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ jobs:
token: ${{ secrets.GH_TOKEN }}

- name: Store the current head ref as a url friendly variable
id: current_branch
env:
HEAD_REF: ${{ github.head_ref }}
run: |
CURRENT_BRANCH=$(echo ${HEAD_REF} | sed -e 's/[]:@\/?&=#%+[\!$()*,;]/-/g')
url_friendly_branch=$(echo ${HEAD_REF} | sed -e 's/[]:@\/?&=#%+[\!$()*,;]/-/g')
echo "CURRENT_BRANCH=$(echo ${url_friendly_branch})" >> $GITHUB_OUTPUT
- name: Set up Python
uses: actions/setup-python@v5
Expand All @@ -44,10 +46,10 @@ jobs:
git config --local user.name "stakater-user"
- name: Deploy PR docs
run: mike deploy --push -b pull-request-deployments $CURRENT_BRANCH
run: mike deploy --push -b pull-request-deployments ${{ steps.current_branch.outputs.CURRENT_BRANCH }}

- name: Update 'latest' alias to latest PR build
run: mike alias --push -b pull-request-deployments --update-aliases $CURRENT_BRANCH latest
run: mike alias --push -b pull-request-deployments --update-aliases ${{ steps.current_branch.outputs.CURRENT_BRANCH }} latest

- name: When publishing a new version, always update the alias to point to the latest version
run: mike set-default --push -b pull-request-deployments latest
Expand All @@ -57,6 +59,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message-success: "@${{ github.actor }} PR doc deploy will soon be available for review on https://stakater.github.io/mto-docs/${CURRENT_BRANCH}"
message-success: "@${{ github.actor }} PR doc deploy will soon be available for review on https://stakater.github.io/mto-docs/${{ steps.current_branch.outputs.CURRENT_BRANCH }}"
message-failure: "@${{ github.actor }} PR doc deploy failed!"
allow-repeats: true

0 comments on commit 4d6b520

Please sign in to comment.