Skip to content

Release 4.0.9 from main #67

Release 4.0.9 from main

Release 4.0.9 from main #67

Workflow file for this run

name: Release
run-name: Release ${{ inputs.version }} from ${{ github.ref_name }}
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g. 4.0.5 or 4.1.0-alpha.1)'
required: true
type: string
permissions:
contents: write # push the release commit and tag, create the release, publish the docs
id-token: write # npm provenance (OIDC)
jobs:
tag:
name: Bump version and tag
if: (github.ref_name == 'main' || endsWith(github.ref_name, '.x')) && github.repository_owner == 'asciidoctor'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Install dependencies
run: npm ci
- name: Bump version and update changelog
run: |
node tasks/version.js ${{ inputs.version }}
node tasks/changelog.js release ${{ inputs.version }}
- name: Commit, tag and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -a -m "${{ inputs.version }}"
git tag v${{ inputs.version }} -m "${{ inputs.version }}"
git push origin ${{ github.ref_name }} v${{ inputs.version }}
build:
needs: tag
uses: ./.github/workflows/build.yml
with:
ref: v${{ inputs.version }}
publish:
name: Publish to npmjs
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: v${{ inputs.version }}
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci
- name: Build core
run: npm run build --prefix packages/core
- name: Publish
run: node tasks/publish.js
- name: Make sure that @asciidoctor/core has been published on npmjs
run: timeout 60s ./scripts/wait-asciidoctor-core-published.sh
release:
name: Publish GitHub release
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: v${{ inputs.version }}
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Install dependencies
run: npm ci
- name: Generate release notes
run: node tasks/changelog.js notes ${{ inputs.version }} > RELEASE_NOTES.md
- name: Download native image artifacts
uses: actions/download-artifact@v8
with:
pattern: native-image-*
path: packages/asciidoctor/dist
merge-multiple: true
# A release from a maintenance branch must not steal the "Latest" badge
# from the release of the current line (gh marks the newest release as
# latest by default).
- name: Create release and upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ inputs.version }}" \
--title "v${{ inputs.version }}" \
--notes-file RELEASE_NOTES.md \
${{ github.ref_name != 'main' && '--latest=false' || '' }} \
packages/asciidoctor/dist/asciidoctor-linux-arm64 \
packages/asciidoctor/dist/asciidoctor-linux-amd64 \
packages/asciidoctor/dist/asciidoctor-darwin-arm64 \
packages/asciidoctor/dist/asciidoctor-win-amd64.exe
- name: Announcement
uses: zulip/github-actions-zulip/send-message@v1
with:
email: ${{ secrets.ZULIP_USERNAME }}
api-key: ${{ secrets.ZULIP_API_KEY }}
organization-url: 'https://asciidoctor.zulipchat.com'
to: '279652'
type: 'stream'
topic: 'releases'
content: |
Asciidoctor.js v${{ inputs.version }} is out!
https://github.com/asciidoctor/asciidoctor.js/releases/tag/v${{ inputs.version }}
docs:
name: Publish API documentation
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: v${{ inputs.version }}
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Install dependencies
run: npm ci
- name: Generate API documentation
run: |
npm run docs --prefix packages/core
npm run docs --prefix packages/asciidoctor
cp -r packages/asciidoctor/build/docs packages/core/build/docs/cli
- name: Compute docs destination folder
id: dest
run: |
VERSION="${{ inputs.version }}"
if [[ "$VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)-(alpha|beta|rc)\. ]]; then
echo "folder=${BASH_REMATCH[1]}-dev" >> "$GITHUB_OUTPUT"
elif [[ "$VERSION" =~ ^([0-9]+\.[0-9]+)\.[0-9]+$ ]]; then
echo "folder=$VERSION" >> "$GITHUB_OUTPUT"
echo "alias=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
else
echo "folder=$VERSION" >> "$GITHUB_OUTPUT"
fi
- name: Publish to gh-pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: packages/core/build/docs
target-folder: ${{ steps.dest.outputs.folder }}
# e.g. 4.0 always points to the docs of the latest 4.0.x release
- name: Publish version alias to gh-pages
if: steps.dest.outputs.alias
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: packages/core/build/docs
target-folder: ${{ steps.dest.outputs.alias }}