diff --git a/.github/workflows/jekyll-deploy.yml b/.github/workflows/jekyll-deploy.yml index db81c1037e..2b322fdb56 100644 --- a/.github/workflows/jekyll-deploy.yml +++ b/.github/workflows/jekyll-deploy.yml @@ -17,7 +17,7 @@ env: SITE_URL: https://docsstaging.opensearch.net concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} + group: ${{ github.workflow }}-${{ github.event.inputs.manual_deploy_branch || github.ref_name }} cancel-in-progress: true jobs: @@ -25,34 +25,35 @@ jobs: runs-on: ubuntu-latest steps: - - name: echo concurrency group - run: echo ${{ github.workflow }}-${{ github.ref_name }} - - name: echo deploy branch - run: echo ${{ github.ref_name }} + - name: Set variables + run: | + deploy_branch=${{ github.event.inputs.manual_deploy_branch || github.ref_name }} + echo "DEPLOY_BRANCH=$deploy_branch" >> $GITHUB_ENV + echo DEPLOY_BRANCH $DEPLOY_BRANCH + echo concurrent group ${{ github.workflow }}-$DEPLOY_BRANCH - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: ruby-version: '3.2' bundler-cache: true - - name: Jekyll Build ${{ github.ref_name }} + - name: Jekyll Build ${{ env.DEPLOY_BRANCH }} run: | - echo ${{ github.event.inputs.manual_deploy_branch }} - echo GITHUB_REF_NAME ${{ github.ref_name }} LATEST_VERSION=$(jq -r '.current' _data/versions.json) echo LATEST_VERSION $LATEST_VERSION - if [ "${{ github.ref_name }}" = "$LATEST_VERSION" ]; then - DESTINATION_KEY="latest" - elif [ "${{ github.ref_name }}" = ${{ github.event.repository.default_branch }} ]; then - #DESTINATION_KEY="staging" - DESTINATION_KEY="latest" + if [ "$DEPLOY_BRANCH" = "$LATEST_VERSION" ]; then + destination_key="latest" + elif [ "$DEPLOY_BRANCH" = ${{ github.event.repository.default_branch }} ]; then + #destination_key="staging" + destination_key="latest" else - DESTINATION_KEY="${{ github.ref_name }}" + destination_key="$DEPLOY_BRANCH" fi - echo "DESTINATION_KEY_ENV=$DESTINATION_KEY" >> $GITHUB_ENV - echo ${{ env.DESTINATION_KEY_ENV }} + echo "DESTINATION_KEY=$destination_key" >> $GITHUB_ENV + echo DESTINATION_KEY $DESTINATION_KEY + bundle install CURRENT_VERSION=$(jq -r '.current' _data/versions.json) sed -i -e "s|^url:.*$|url:\ \"$SITE_URL\"|g" _config.yml @@ -68,4 +69,4 @@ jobs: branch: gh-pages folder: _site clean: true - target-folder: docs/${{ env.DESTINATION_KEY_ENV }} + target-folder: docs/${{ env.DESTINATION_KEY }}