From 831f5178d9e8c1fcf694ff00c464f48a5c5f813d Mon Sep 17 00:00:00 2001 From: Jarno Elovirta Date: Tue, 7 Nov 2023 19:00:30 +0200 Subject: [PATCH 1/2] Add workflow to update GitHub Actions configuration Signed-off-by: Jarno Elovirta --- .github/workflows/release.yml | 199 +++++++++++++++++++--------------- 1 file changed, 114 insertions(+), 85 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dca91cd0..75f98ec6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,104 +15,133 @@ on: types: [release] jobs: - deploy: + # deploy: + # runs-on: ubuntu-latest + # env: + # WEBSITE_PLUGIN_BRANCH: 'master' + # DITA_OT_VERSION: '4.0.1' + # steps: + # - name: Parse arguments + # run: | + # if [[ -n "${{ github.event.client_payload.dita_ot_version }}" ]]; then + # readonly TOKENS=($(echo "${{ github.event.client_payload.dita_ot_version }}" | tr '.' ' ')) + # else + # readonly TOKENS=($(echo "${{ github.event.inputs.dita-ot-version }}" | tr '.' ' ')) + # fi + # echo "RELEASE=${TOKENS[0]}.${TOKENS[1]}" >> $GITHUB_ENV + # if [[ -n "${{ github.event.client_payload.docs_tag }}" ]]; then + # echo "TAG=${{ github.event.client_payload.docs_tag }}" >> $GITHUB_ENV + # else + # echo "TAG=${{ github.event.inputs.docs-tag }}" >> $GITHUB_ENV + # fi + # + # - name: Check out docs + # uses: actions/checkout@v4 + # with: + # ref: ${{ env.TAG }} + # + # - name: Set variables + # run: | + # echo "GITHUB_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + # + # - name: Set up JDK 17 + # uses: actions/setup-java@v3 + # with: + # distribution: temurin + # java-version: 17 + # + # - name: Check out website + # uses: actions/checkout@v4 + # with: + # repository: dita-ot/website + # token: ${{ secrets.COMMITTER_TOKEN }} + # path: website + # + # - name: Download website plug-in + # run: | + # curl -sL https://github.com/dita-ot/org.dita-ot.html/archive/refs/heads/${{ env.WEBSITE_PLUGIN_BRANCH }}.zip -o org.dita-ot.html.zip + # + # - name: Cache render DITA-OT + # uses: actions/cache@v3 + # with: + # path: dita-ot-${{ env.DITA_OT_VERSION }} + # key: ${{ runner.os }}-dita-ot-${{ env.DITA_OT_VERSION }} + # - name: Download render DITA-OT + # run: | + # if [ ! -d "dita-ot-${{ env.DITA_OT_VERSION }}" ]; then + # curl -sL https://github.com/dita-ot/dita-ot/releases/download/${{ env.DITA_OT_VERSION }}/dita-ot-${{ env.DITA_OT_VERSION }}.zip -o dita-ot-${{ env.DITA_OT_VERSION }}.zip + # unzip dita-ot-${{ env.DITA_OT_VERSION }}.zip + # else + # echo "Use cached dita-ot-${{ env.DITA_OT_VERSION }}" + # fi + # dita-ot-${{ env.DITA_OT_VERSION }}/bin/dita install org.dita-ot.html.zip --force -v + # + # - name: Download release DITA-OT + # run: | + # curl -sL https://github.com/dita-ot/dita-ot/releases/download/$VERSION/dita-ot-$VERSION.zip -o dita-ot-$VERSION.zip + # unzip dita-ot-$VERSION.zip -d src-dita-ot + # env: + # VERSION: ${{ github.event.inputs.dita-ot-version }} + # + # - name: Run DITA-OT + # run: | + # ./gradlew site \ + # -PditaHome=$DITA_HOME \ + # -PoutputDir=$WEBSITE_DIR/${{ env.RELEASE }} \ + # -PditaHomeSrc=${{ env.RELEASE_DITA_OT }} \ + # -PnoCommitMeta=true \ + # --info --stacktrace --no-daemon + # env: + # VERSION: ${{ github.event.inputs.dita-ot-version }} + # WEBSITE_DIR: ${{ github.workspace }}/website + # DITA_HOME: ${{ github.workspace }}/dita-ot-${{ env.DITA_OT_VERSION }} + # RELEASE_DITA_OT: ${{ github.workspace }}/src-dita-ot/dita-ot-${{ github.event.inputs.dita-ot-version }} + # + # - name: Create release PR + # uses: peter-evans/create-pull-request@v5 + # with: + # branch: release/${{ github.event.inputs.dita-ot-version }} + # title: 'Update site for ${{ github.event.inputs.dita-ot-version }}' + # body: | + # Update DITA-OT ${{ github.event.inputs.dita-ot-version }} docs to `/${{ env.RELEASE }}`. + # + # Built from commits: + # * dita-ot/docs@${{ env.GITHUB_SHA_SHORT }} (${{ github.event.inputs.docs-tag }}) + # * dita-ot/dita-ot (${{ github.event.inputs.dita-ot-version }}) + # * dita-ot/org.dita-ot.html (${{ env.WEBSITE_PLUGIN_BRANCH }}) + # commit-message: 'Update ‘${{ env.RELEASE }}’ docs for ${{ github.event.inputs.dita-ot-version }}' + # committer: 'DITA-OT Bot ' + # signoff: true + # token: ${{ secrets.DOCS_RELEASE_TOKEN }} + # path: website + # labels: | + # release-updates + + update-ci: runs-on: ubuntu-latest - env: - WEBSITE_PLUGIN_BRANCH: 'master' - DITA_OT_VERSION: '4.0.1' steps: - - name: Parse arguments - run: | - if [[ -n "${{ github.event.client_payload.dita_ot_version }}" ]]; then - readonly TOKENS=($(echo "${{ github.event.client_payload.dita_ot_version }}" | tr '.' ' ')) - else - readonly TOKENS=($(echo "${{ github.event.inputs.dita-ot-version }}" | tr '.' ' ')) - fi - echo "RELEASE=${TOKENS[0]}.${TOKENS[1]}" >> $GITHUB_ENV - if [[ -n "${{ github.event.client_payload.docs_tag }}" ]]; then - echo "TAG=${{ github.event.client_payload.docs_tag }}" >> $GITHUB_ENV - else - echo "TAG=${{ github.event.inputs.docs-tag }}" >> $GITHUB_ENV - fi - - name: Check out docs uses: actions/checkout@v4 - with: - ref: ${{ env.TAG }} - - - name: Set variables - run: | - echo "GITHUB_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 17 - - name: Check out website - uses: actions/checkout@v4 + - name: Update GitHub Actions release workflow + uses: mikefarah/yq@master with: - repository: dita-ot/website - token: ${{ secrets.COMMITTER_TOKEN }} - path: website - - - name: Download website plug-in - run: | - curl -sL https://github.com/dita-ot/org.dita-ot.html/archive/refs/heads/${{ env.WEBSITE_PLUGIN_BRANCH }}.zip -o org.dita-ot.html.zip - - - name: Cache render DITA-OT - uses: actions/cache@v3 + cmd: yq -i '.jobs.deploy.env.DITA_OT_VERSION = "${{ github.event.inputs.dita-ot-version }}"' '.github/workflows/release.yml' + - name: Update GitHub Actions render action + uses: mikefarah/yq@master with: - path: dita-ot-${{ env.DITA_OT_VERSION }} - key: ${{ runner.os }}-dita-ot-${{ env.DITA_OT_VERSION }} - - name: Download render DITA-OT - run: | - if [ ! -d "dita-ot-${{ env.DITA_OT_VERSION }}" ]; then - curl -sL https://github.com/dita-ot/dita-ot/releases/download/${{ env.DITA_OT_VERSION }}/dita-ot-${{ env.DITA_OT_VERSION }}.zip -o dita-ot-${{ env.DITA_OT_VERSION }}.zip - unzip dita-ot-${{ env.DITA_OT_VERSION }}.zip - else - echo "Use cached dita-ot-${{ env.DITA_OT_VERSION }}" - fi - dita-ot-${{ env.DITA_OT_VERSION }}/bin/dita install org.dita-ot.html.zip --force -v - - - name: Download release DITA-OT - run: | - curl -sL https://github.com/dita-ot/dita-ot/releases/download/$VERSION/dita-ot-$VERSION.zip -o dita-ot-$VERSION.zip - unzip dita-ot-$VERSION.zip -d src-dita-ot - env: - VERSION: ${{ github.event.inputs.dita-ot-version }} - - - name: Run DITA-OT - run: | - ./gradlew site \ - -PditaHome=$DITA_HOME \ - -PoutputDir=$WEBSITE_DIR/${{ env.RELEASE }} \ - -PditaHomeSrc=${{ env.RELEASE_DITA_OT }} \ - -PnoCommitMeta=true \ - --info --stacktrace --no-daemon - env: - VERSION: ${{ github.event.inputs.dita-ot-version }} - WEBSITE_DIR: ${{ github.workspace }}/website - DITA_HOME: ${{ github.workspace }}/dita-ot-${{ env.DITA_OT_VERSION }} - RELEASE_DITA_OT: ${{ github.workspace }}/src-dita-ot/dita-ot-${{ github.event.inputs.dita-ot-version }} + cmd: yq -i '.inputs.DITA_OT_VERSION.default = "${{ github.event.inputs.dita-ot-version }}"' '.github/actions/render/action.yml' - name: Create release PR uses: peter-evans/create-pull-request@v5 with: - branch: release/${{ github.event.inputs.dita-ot-version }} - title: 'Update site for ${{ github.event.inputs.dita-ot-version }}' + branch: release/github-actions-${{ github.event.inputs.dita-ot-version }} + title: 'Update docs GitHub Actions for ${{ github.event.inputs.dita-ot-version }}' body: | - Update DITA-OT ${{ github.event.inputs.dita-ot-version }} docs to `/${{ env.RELEASE }}`. - - Built from commits: - * dita-ot/docs@${{ env.GITHUB_SHA_SHORT }} (${{ github.event.inputs.docs-tag }}) - * dita-ot/dita-ot (${{ github.event.inputs.dita-ot-version }}) - * dita-ot/org.dita-ot.html (${{ env.WEBSITE_PLUGIN_BRANCH }}) - commit-message: 'Update ‘${{ env.RELEASE }}’ docs for ${{ github.event.inputs.dita-ot-version }}' + Update docs GitHub Actions for ${{ github.event.inputs.dita-ot-version }}. + commit-message: 'Update GitHub Actions for ${{ github.event.inputs.dita-ot-version }}' committer: 'DITA-OT Bot ' signoff: true - token: ${{ secrets.COMMITTER_TOKEN }} - path: website + token: ${{ secrets.DOCS_RELEASE_TOKEN }} labels: | release-updates From e74c8c47a86e71f17646ca0f3337d3ef7d1d36c6 Mon Sep 17 00:00:00 2001 From: jelovirt Date: Fri, 10 Nov 2023 08:41:58 +0000 Subject: [PATCH 2/2] Update GitHub Actions for 4.1.2 Signed-off-by: DITA-OT Bot --- .github/actions/render/action.yml | 6 +----- .github/workflows/release.yml | 8 +++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/actions/render/action.yml b/.github/actions/render/action.yml index df87d2fa..02f8c0f4 100644 --- a/.github/actions/render/action.yml +++ b/.github/actions/render/action.yml @@ -6,7 +6,7 @@ inputs: default: 'master' DITA_OT_VERSION: description: 'DITA-OT version used for rendering' - default: '4.0.1' + default: '4.1.2' runs: using: 'composite' steps: @@ -23,7 +23,6 @@ runs: uses: ruby/setup-ruby@v1 with: ruby-version: 2.6 - - name: Download website plug-in shell: bash run: | @@ -33,7 +32,6 @@ runs: with: path: dita-ot-${{ inputs.DITA_OT_VERSION }} key: ${{ runner.os }}-dita-ot-${{ inputs.DITA_OT_VERSION }} - - name: Download stable DITA-OT shell: bash run: | @@ -44,7 +42,6 @@ runs: echo "Use cached dita-ot-${{ inputs.DITA_OT_VERSION }}" fi dita-ot-${{ inputs.DITA_OT_VERSION }}/bin/dita install org.dita-ot.html.zip --force -v - - name: Get develop DITA-OT ETag shell: bash run: | @@ -66,7 +63,6 @@ runs: echo "Use cached dita-ot-develop" fi echo "DITA_OT_DEV=$(find dita-ot-develop -name 'dita-ot-*@*' -type d | head -1)" >> $GITHUB_ENV - - name: Run DITA-OT shell: bash run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75f98ec6..1a2ef43f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,6 @@ # This workflow builds changes to release tag and commits to website repo for release PR name: Generate website release PR - on: workflow_dispatch: inputs: @@ -13,7 +12,6 @@ on: required: true repository_dispatch: types: [release] - jobs: # deploy: # runs-on: ubuntu-latest @@ -116,13 +114,11 @@ jobs: # path: website # labels: | # release-updates - update-ci: runs-on: ubuntu-latest steps: - name: Check out docs uses: actions/checkout@v4 - - name: Update GitHub Actions release workflow uses: mikefarah/yq@master with: @@ -131,7 +127,6 @@ jobs: uses: mikefarah/yq@master with: cmd: yq -i '.inputs.DITA_OT_VERSION.default = "${{ github.event.inputs.dita-ot-version }}"' '.github/actions/render/action.yml' - - name: Create release PR uses: peter-evans/create-pull-request@v5 with: @@ -145,3 +140,6 @@ jobs: token: ${{ secrets.DOCS_RELEASE_TOKEN }} labels: | release-updates + deploy: + env: + DITA_OT_VERSION: 4.1.2