Skip to content

build(deps): bump actions/upload-artifact from 3 to 4 #563

build(deps): bump actions/upload-artifact from 3 to 4

build(deps): bump actions/upload-artifact from 3 to 4 #563

Workflow file for this run

name: Build and Publish the Book
on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
workflow_dispatch:
jobs:
xml-translation:
name: Translate XML
runs-on: ubuntu-22.04
steps:
- name: Prepare
run: |
sudo apt update
sudo apt install gettext python3-polib po4a
echo "MAKEFLAGS=-j2" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Update po Files
run: make pofiles
- name: Check for Untranslated or Fuzzy Strings
run: ./check-translations.sh
- name: Create Translated XML Files
run: |
echo 'MLANG=zh_CN' > local.mk
make booksrc
tar -C zh_CN -cf book.tar book
- name: Upload Translated XML Files
uses: actions/upload-artifact@v4
with:
name: lfs-xml-zh_CN
path: book.tar
- name: Upload Auxilary Files
uses: actions/upload-artifact@v4
with:
name: aux-files
path: aux-files
build-sysv-html:
needs: xml-translation
name: Build Chunked HTML (sysv)
runs-on: ubuntu-22.04
steps:
- name: Prepare
run: |
sudo apt update
sudo apt install xsltproc libxml2-utils docbook-xml docbook-xsl tidy
- name: Fetch XML
uses: actions/download-artifact@v4
with:
name: lfs-xml-zh_CN
- name: Untar XML
run: tar --strip-components=1 -xf book.tar
- name: Generate Translated Book
run: |
make REV=sysv book BASEDIR=lfs-sysv-zh_CN
tar -cJf lfs-sysv-zh_CN.tar.xz lfs-sysv-zh_CN
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: lfs-sysv-zh_CN-html
path: lfs-sysv-zh_CN.tar.xz
upload-sysv-html:
if: github.event_name != 'pull_request' && github.ref_type == 'branch'
needs: build-sysv-html
name: Upload Chunked HTML (sysv)
runs-on: ubuntu-22.04
steps:
- name: Prepare SSH Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Fetch the Book
uses: actions/download-artifact@v4
with:
name: lfs-sysv-zh_CN-html
- name: Fetch Auxilary Files
uses: actions/download-artifact@v4
with:
name: aux-files
- name: Set SSH Host Key
run: cat known_hosts >> ~/.ssh/known_hosts
- name: Set Environment
run: sh setenv.sh "${GITHUB_REF}"
- name: Upload the Book
run: |
scp lfs-sysv-zh_CN.tar.xz "[email protected]:/tmp/lfs-sysv-zh_CN.tar.xz"
ssh "[email protected]" "/usr/local/bin/update-lfs" "/tmp/lfs-sysv-zh_CN.tar.xz" "/var/www/xry111/lfs/zh_CN/${SYSV}"
build-systemd-html:
needs: xml-translation
name: Build Chunked HTML (systemd)
runs-on: ubuntu-22.04
steps:
- name: Prepare
run: |
sudo apt update
sudo apt install xsltproc libxml2-utils docbook-xml docbook-xsl tidy
- name: Fetch XML
uses: actions/download-artifact@v4
with:
name: lfs-xml-zh_CN
- name: Untar XML
run: tar --strip-components=1 -xf book.tar
- name: Generate Translated Book
run: |
make REV=systemd book BASEDIR=lfs-systemd-zh_CN
tar -cJf lfs-systemd-zh_CN.tar.xz lfs-systemd-zh_CN
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: lfs-systemd-zh_CN-html
path: lfs-systemd-zh_CN.tar.xz
upload-systemd-html:
if: github.event_name != 'pull_request' && github.ref_type == 'branch'
needs: build-systemd-html
name: Upload Chunked HTML (systemd)
runs-on: ubuntu-22.04
steps:
- name: Prepare SSH Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Fetch the Book
uses: actions/download-artifact@v4
with:
name: lfs-systemd-zh_CN-html
- name: Fetch Auxilary Files
uses: actions/download-artifact@v4
with:
name: aux-files
- name: Set SSH Host Key
run: cat known_hosts >> ~/.ssh/known_hosts
- name: Set Environment
run: sh setenv.sh "${GITHUB_REF}"
- name: Upload the Book
run: |
scp lfs-systemd-zh_CN.tar.xz "[email protected]:/tmp/lfs-systemd-zh_CN.tar.xz"
ssh "[email protected]" "/usr/local/bin/update-lfs" "/tmp/lfs-systemd-zh_CN.tar.xz" "/var/www/xry111/lfs/zh_CN/${SYSD}"
build-sysv-nochunks:
needs: xml-translation
name: Build Single Page HTML (sysv)
runs-on: ubuntu-22.04
steps:
- name: Prepare
run: |
sudo apt update
sudo apt install xsltproc libxml2-utils docbook-xml docbook-xsl tidy
- name: Fetch XML
uses: actions/download-artifact@v4
with:
name: lfs-xml-zh_CN
- name: Untar XML
run: tar --strip-components=1 -xf book.tar
- name: Generate Translated Book
run: make REV=sysv nochunks BASEDIR=render
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: lfs-sysv-zh_CN-nochunks
path: render/LFS-BOOK.html
# attention: upload-sysv-{nochunks,pdf} must be scheduled after
# upload-sysv-html, because the latter will delete and recreate the
# directory containing the book. For systemd, likewise.
upload-sysv-nochunks:
if: github.event_name != 'pull_request' && github.ref_type == 'branch'
needs: [build-sysv-nochunks, upload-sysv-html]
name: Upload Single Page HTML (sysv)
runs-on: ubuntu-22.04
steps:
- name: Prepare SSH Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Fetch the Book
uses: actions/download-artifact@v4
with:
name: lfs-sysv-zh_CN-nochunks
- name: Fetch Auxilary Files
uses: actions/download-artifact@v4
with:
name: aux-files
- name: Set SSH Host Key
run: cat known_hosts >> ~/.ssh/known_hosts
- name: Set Environment
run: sh setenv.sh "${GITHUB_REF}"
- name: Upload the Book
run: scp LFS-BOOK.html "[email protected]:/var/www/xry111/lfs/zh_CN/${SYSV}"
build-systemd-nochunks:
needs: xml-translation
name: Build Single Page HTML (systemd)
runs-on: ubuntu-22.04
steps:
- name: Prepare
run: |
sudo apt update
sudo apt install xsltproc libxml2-utils docbook-xml docbook-xsl tidy
- name: Fetch XML
uses: actions/download-artifact@v4
with:
name: lfs-xml-zh_CN
- name: Untar XML
run: tar --strip-components=1 -xf book.tar
- name: Generate Translated Book
run: make REV=systemd nochunks BASEDIR=render
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: lfs-systemd-zh_CN-nochunks
path: render/LFS-SYSD-BOOK.html
upload-systemd-nochunks:
if: github.event_name != 'pull_request' && github.ref_type == 'branch'
needs: [build-systemd-nochunks, upload-systemd-html]
name: Upload Single Page HTML (systemd)
runs-on: ubuntu-22.04
steps:
- name: Prepare SSH Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Fetch the Book
uses: actions/download-artifact@v4
with:
name: lfs-systemd-zh_CN-nochunks
- name: Fetch Auxilary Files
uses: actions/download-artifact@v4
with:
name: aux-files
- name: Set SSH Host Key
run: cat known_hosts >> ~/.ssh/known_hosts
- name: Set Environment
run: sh setenv.sh "${GITHUB_REF}"
- name: Upload the Book
run: scp LFS-SYSD-BOOK.html "[email protected]:/var/www/xry111/lfs/zh_CN/${SYSD}"
build-sysv-pdf:
needs: xml-translation
name: Build PDF (sysv)
runs-on: ubuntu-22.04
steps:
- name: Prepare
run: |
sudo apt update
sudo apt install xsltproc libxml2-utils docbook-xml docbook-xsl fop
- name: Fetch XML
uses: actions/download-artifact@v4
with:
name: lfs-xml-zh_CN
path: .
- name: Untar XML
run: tar --strip-components=1 -xf book.tar
- name: Cache Fonts
uses: actions/cache@v3
with:
path: fonts/
key: ${{ hashFiles('noto-cjk-commit', 'source-han-mono-commit') }}
- name: Generate Translated Book
run: make REV=sysv pdf BASEDIR=render
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: lfs-sysv-zh_CN-pdf
path: render/LFS-BOOK.pdf
upload-sysv-pdf:
if: github.event_name != 'pull_request' && github.ref_type == 'branch'
needs: [build-sysv-pdf, upload-sysv-html]
name: Upload PDF (sysv)
runs-on: ubuntu-22.04
steps:
- name: Prepare SSH Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Fetch the Book
uses: actions/download-artifact@v4
with:
name: lfs-sysv-zh_CN-pdf
- name: Fetch Auxilary Files
uses: actions/download-artifact@v4
with:
name: aux-files
- name: Set SSH Host Key
run: cat known_hosts >> ~/.ssh/known_hosts
- name: Set Environment
run: sh setenv.sh "${GITHUB_REF}"
- name: Upload the Book
run: scp LFS-BOOK.pdf "[email protected]:/var/www/xry111/lfs/zh_CN/${SYSV}"
build-systemd-pdf:
needs: xml-translation
name: Build PDF (systemd)
runs-on: ubuntu-22.04
steps:
- name: Prepare
run: |
sudo apt update
sudo apt install xsltproc libxml2-utils docbook-xml docbook-xsl fop
- name: Fetch XML
uses: actions/download-artifact@v4
with:
name: lfs-xml-zh_CN
path: .
- name: Untar XML
run: tar --strip-components=1 -xf book.tar
- name: Cache Fonts
uses: actions/cache@v3
with:
path: fonts/
key: ${{ hashFiles('noto-cjk-commit', 'source-han-mono-commit') }}
- name: Generate Translated Book
run: |
make REV=systemd pdf BASEDIR=render
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: lfs-systemd-zh_CN-pdf
path: render/LFS-SYSD-BOOK.pdf
upload-systemd-pdf:
if: github.event_name != 'pull_request' && github.ref_type == 'branch'
needs: [build-systemd-pdf, upload-systemd-html]
name: Upload PDF (systemd)
runs-on: ubuntu-22.04
steps:
- name: Prepare SSH Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Fetch the Book
uses: actions/download-artifact@v4
with:
name: lfs-systemd-zh_CN-pdf
- name: Fetch Auxilary Files
uses: actions/download-artifact@v4
with:
name: aux-files
- name: Set SSH Host Key
run: cat known_hosts >> ~/.ssh/known_hosts
- name: Set Environment
run: sh setenv.sh "${GITHUB_REF}"
- name: Upload the Book
run: scp LFS-SYSD-BOOK.pdf "[email protected]:/var/www/xry111/lfs/zh_CN/${SYSD}"
make_release:
if: github.event_name != 'pull_request' && github.ref_type == 'tag'
permissions:
contents: write
needs:
- build-sysv-html
- build-sysv-nochunks
- build-sysv-pdf
- build-systemd-html
- build-systemd-nochunks
- build-systemd-pdf
name: Create Release
runs-on: ubuntu-22.04
steps:
- name: Determine Version
env:
TAG: ${{ github.ref_name }}
run: echo VERSION=$(echo $TAG | sed 's/^v//') >> $GITHUB_ENV
- name: Fetch Chunked HTML (sysv)
uses: actions/download-artifact@v4
with:
name: lfs-sysv-zh_CN-html
path: ${{ runner.temp }}/release
- name: Fetch Single Page HTML (sysv)
uses: actions/download-artifact@v4
with:
name: lfs-sysv-zh_CN-nochunks
path: ${{ runner.temp }}/release
- name: Fetch PDF (sysv)
uses: actions/download-artifact@v4
with:
name: lfs-sysv-zh_CN-pdf
path: ${{ runner.temp }}/release
- name: Fetch Chunked HTML (systemd)
uses: actions/download-artifact@v4
with:
name: lfs-systemd-zh_CN-html
path: ${{ runner.temp }}/release
- name: Fetch Single Page HTML (systemd)
uses: actions/download-artifact@v4
with:
name: lfs-systemd-zh_CN-nochunks
path: ${{ runner.temp }}/release
- name: Fetch PDF (systemd)
uses: actions/download-artifact@v4
with:
name: lfs-systemd-zh_CN-pdf
path: ${{ runner.temp }}/release
- name: Rename artifacts
env:
DIR: ${{ runner.temp }}/release
run: |
mv $DIR/lfs-{sysv,${VERSION}}-zh_CN.tar.xz
mv $DIR/lfs-{,${VERSION}-}systemd-zh_CN.tar.xz
mv $DIR/{LFS-BOOK.html,lfs-${VERSION}-zh_CN.html}
mv $DIR/{LFS-SYSD-BOOK.html,lfs-${VERSION}-systemd-zh_CN.html}
mv $DIR/{LFS-BOOK.pdf,lfs-${VERSION}-zh_CN.pdf}
mv $DIR/{LFS-SYSD-BOOK.pdf,lfs-${VERSION}-systemd-zh_CN.pdf}
- name: Release
uses: softprops/action-gh-release@v1
with:
files: ${{ runner.temp }}/release/*.*
name: Linux From Scratch ${{ env.VERSION }}
prerelease: ${{ contains(github.ref_name, 'rc') }}