Skip to content

release

release #34

Workflow file for this run

# This workflow builds changes to release tag and commits to website repo for release PR
name: Generate website release PR
on:
workflow_dispatch:
inputs:
dita-ot-version:
description: 'DITA-OT version'
required: true
docs-tag:
description: 'Docs tag'
required: true
repository_dispatch:
types: [release]
jobs:
deploy:
runs-on: ubuntu-latest
env:
WEBSITE_PLUGIN_BRANCH: 'master'
DITA_OT_VERSION: '4.2.3'
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 '.' ' '))
echo "RELEASE_VERSION=${{ github.event.client_payload.dita_ot_version }}" >> $GITHUB_ENV
else
readonly TOKENS=($(echo "${{ github.event.inputs.dita-ot-version }}" | tr '.' ' '))
echo "RELEASE_VERSION=${{ github.event.inputs.dita-ot-version }}" >> $GITHUB_ENV
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@v4
with:
distribution: temurin
java-version: 17
cache: 'gradle'
- 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@v4
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: ${{ env.RELEASE_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: ${{ env.RELEASE_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-${{ env.RELEASE_VERSION }}
- name: Create release PR
uses: peter-evans/create-pull-request@v7
with:
branch: release/${{ env.RELEASE_VERSION }}
title: 'Update site for ${{ env.RELEASE_VERSION }}'
body: |
Update DITA-OT ${{ env.RELEASE_VERSION }} docs to `/${{ env.RELEASE }}`.
Built from commits:
* dita-ot/docs@${{ env.GITHUB_SHA_SHORT }} (${{ github.event.inputs.docs-tag }})
* dita-ot/dita-ot (${{ env.RELEASE_VERSION }})
* dita-ot/org.dita-ot.html (${{ env.WEBSITE_PLUGIN_BRANCH }})
commit-message: 'Update ‘${{ env.RELEASE }}’ docs for ${{ env.RELEASE_VERSION }}'
committer: 'DITA-OT Bot <[email protected]>'
author: 'DITA-OT Bot <[email protected]>'
signoff: true
token: ${{ secrets.DOCS_RELEASE_TOKEN }}
path: website
labels: |
release-updates
update-ci:
runs-on: ubuntu-latest
steps:
- name: Parse arguments
run: |
if [[ -n "${{ github.event.client_payload.dita_ot_version }}" ]]; then
echo "RELEASE_VERSION=${{ github.event.client_payload.dita_ot_version }}" >> $GITHUB_ENV
else
echo "RELEASE_VERSION=${{ github.event.inputs.dita-ot-version }}" >> $GITHUB_ENV
fi
- name: Check out docs
uses: actions/checkout@v4
with:
ref: develop
- name: Update GitHub Actions release workflow
uses: mikefarah/yq@master
with:
cmd: yq -i '.jobs.deploy.env.DITA_OT_VERSION = "${{ env.RELEASE_VERSION }}"' '.github/workflows/release.yml'
- name: Update GitHub Actions render action
uses: mikefarah/yq@master
with:
cmd: yq -i '.inputs.DITA_OT_VERSION.default = "${{ env.RELEASE_VERSION }}"' '.github/actions/render/action.yml'
- name: Create release PR
uses: peter-evans/create-pull-request@v7
with:
branch: feature/update-github-actions-${{ env.RELEASE_VERSION }}
title: 'Update docs GitHub Actions for ${{ env.RELEASE_VERSION }}'
body: |
Update docs GitHub Actions for ${{ env.RELEASE_VERSION }}.
commit-message: 'Update GitHub Actions for ${{ env.RELEASE_VERSION }}'
committer: 'DITA-OT Bot <[email protected]>'
author: 'DITA-OT Bot <[email protected]>'
signoff: true
token: ${{ secrets.DOCS_RELEASE_TOKEN }}
labels: |
release-updates