mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-08-10 16:37:34 +00:00
Bumps the dependencies group with 2 updates in the / directory: [actions/checkout](https://github.com/actions/checkout) and [softprops/action-gh-release](https://github.com/softprops/action-gh-release). Updates `actions/checkout` from 6 to 7 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v6...v7) Updates `softprops/action-gh-release` from 2 to 3 - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major dependency-group: dependencies - dependency-name: softprops/action-gh-release dependency-version: '3' dependency-type: direct:production update-type: version-update:semver-major dependency-group: dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
106 lines
3.9 KiB
Go
106 lines
3.9 KiB
Go
name: Auto Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Check project rules
|
|
run: python3 check_project_rules.py
|
|
|
|
- name: Check release metadata
|
|
run: npm test
|
|
|
|
- name: Install Chromium and CJK fonts
|
|
id: setupchrome
|
|
uses: browser-actions/setup-chrome@v2
|
|
with:
|
|
chrome-version: stable
|
|
- name: Install CJK fonts
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y fonts-noto-cjk fonts-noto-cjk-extra
|
|
|
|
- name: Install mdpress 0.7.10
|
|
env:
|
|
MDPRESS_VERSION: "0.7.10"
|
|
MDPRESS_SHA256: "17e53e455996940bbbce64c69c43b3fb543f1501e03b74cf0434074efebd2db4"
|
|
run: |
|
|
archive="/tmp/mdpress_${MDPRESS_VERSION}_linux_amd64.tar.gz"
|
|
echo "Installing mdpress ${MDPRESS_VERSION}"
|
|
curl -fsSL "https://github.com/yeasy/mdPress/releases/download/v${MDPRESS_VERSION}/mdpress_${MDPRESS_VERSION}_linux_amd64.tar.gz" -o "$archive"
|
|
echo "${MDPRESS_SHA256} $archive" | sha256sum -c -
|
|
tar xzf "$archive" -C /tmp mdpress
|
|
sudo mv /tmp/mdpress /usr/local/bin/
|
|
mdpress --version
|
|
|
|
- name: Extract tag name
|
|
id: tag
|
|
run: |
|
|
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
|
|
tag_name="${GITHUB_REF#refs/tags/}"
|
|
else
|
|
tag_name="latest"
|
|
fi
|
|
safe_tag_name=$(printf '%s' "$tag_name" | sed 's/[^A-Za-z0-9._-]/-/g')
|
|
safe_tag_name="${safe_tag_name:-latest}"
|
|
echo "TAG_NAME=${tag_name}" >> "$GITHUB_OUTPUT"
|
|
echo "SAFE_TAG_NAME=${safe_tag_name}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Build PDF
|
|
run: mdpress build --format pdf --output docker_practice-${{ steps.tag.outputs.SAFE_TAG_NAME || 'latest' }}.pdf
|
|
|
|
- name: Create Release with PDF
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: softprops/action-gh-release@v3
|
|
with:
|
|
generate_release_notes: true
|
|
files: docker_practice-${{ steps.tag.outputs.SAFE_TAG_NAME }}.pdf
|
|
|
|
- name: Upload PDF as artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: docker_practice-pdf
|
|
path: "docker_practice-*.pdf"
|
|
|
|
- name: Build HTML reader
|
|
id: htmlreader
|
|
continue-on-error: true
|
|
env:
|
|
CHROME_BIN: ${{ steps.setupchrome.outputs.chrome-path }}
|
|
run: |
|
|
# recent pandoc (apt's is too old for --embed-resources); + mermaid-cli using system Chrome
|
|
curl -fsSL https://github.com/jgm/pandoc/releases/download/3.5/pandoc-3.5-1-amd64.deb -o /tmp/pandoc.deb
|
|
sudo dpkg -i /tmp/pandoc.deb && pandoc --version | head -1
|
|
PUPPETEER_SKIP_DOWNLOAD=true npm install -g @mermaid-js/mermaid-cli@10
|
|
TITLE=$(python3 -c "import json,os;print((json.load(open('book.json')).get('title') if os.path.exists('book.json') else '') or '${{ github.event.repository.name }}')")
|
|
TAG="${{ steps.tag.outputs.SAFE_TAG_NAME || 'latest' }}"
|
|
python3 tools/render_mermaid.py --book-dir . --svg-out /tmp/mmsvg
|
|
python3 tools/build_html_reader.py --book-dir . --title "$TITLE" --svg-dir /tmp/mmsvg \
|
|
--out "${{ github.event.repository.name }}-${TAG}.html"
|
|
ls -lh ${{ github.event.repository.name }}-${TAG}.html
|
|
|
|
- name: Attach HTML to release
|
|
if: steps.htmlreader.outcome == 'success' && startsWith(github.ref, 'refs/tags/')
|
|
uses: softprops/action-gh-release@v3
|
|
with:
|
|
tag_name: ${{ steps.tag.outputs.TAG_NAME }}
|
|
files: "${{ github.event.repository.name }}-${{ steps.tag.outputs.SAFE_TAG_NAME }}.html"
|
|
|
|
- name: Upload HTML as artifact
|
|
if: steps.htmlreader.outcome == 'success'
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: html-edition
|
|
path: "${{ github.event.repository.name }}-*.html"
|