Merge pull request #5 from kevinbackhouse/v0.28.2 #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/marketplace/actions/github-pages-action | |
name: GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
deploy: | |
strategy: | |
matrix: | |
EXIV2TAG: [v0.28.2] | |
runs-on: ubuntu-22.04 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- name: Checkout team repository | |
uses: actions/checkout@v2 | |
with: | |
path: team | |
- name: Checkout exiv2 repository | |
uses: actions/checkout@v2 | |
with: | |
repository: Exiv2/exiv2 | |
path: exiv2 | |
ref: ${{ matrix.EXIV2TAG }} | |
- name: Set environment variables | |
run: | | |
echo "EXIV2WEB=$GITHUB_WORKSPACE/team/website" >> $GITHUB_ENV | |
echo "EXIV2HOME=$GITHUB_WORKSPACE/exiv2" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: sudo apt-get install -y cmake make g++ man2html python3 doxygen xsltproc ghostscript man2html graphviz libbrotli-dev libinih-dev pandoc | |
- name: Copy Robin's book | |
run: | | |
mkdir $EXIV2WEB/html/book | |
find $EXIV2WEB/../book -maxdepth 1 -type f | xargs -I{} cp -v {} $EXIV2WEB/html/book | |
sed s'#<title>IMaEA</title>#<title>Image Metadata and Exiv2 Architecture</title>#' $EXIV2WEB/html/book/IMaEA.html > $EXIV2WEB/html/book/index.html | |
sed -i 's,../book/,book/,' $EXIV2WEB/var/__navbar* | |
- name: Build exiv2 | |
run: | | |
cmake -S$EXIV2HOME -B$EXIV2HOME/build -DEXIV2_ENABLE_BMFF=1 -DEXIV2_BUILD_SAMPLES=ON -DCMAKE_INSTALL_PREFIX=$EXIV2HOME/install | |
cmake --build $EXIV2HOME/build -- install -j$(nproc) | |
EXIV2_BINDIR=$EXIV2HOME/build/bin make -C $EXIV2HOME/doc/templates | |
- name: Build exiv2.org static content | |
run: | | |
echo -n ${{ matrix.EXIV2TAG }} | sed -e 's,-RC\([0-9]\),.\1,g' -e 's,v,,g' > $EXIV2WEB/var/__version__ | |
# Populate builds and releases | |
python3 -m pip install PyGithub 'pyopenssl>=22.0.0' | |
python3 <<EOF | grep -v sha256 | grep -v nightly | grep -v untagged > /tmp/artifacts.txt | |
from github import Github | |
g = Github("${{ secrets.GITHUB_TOKEN }}") | |
repo = g.get_repo("Exiv2/exiv2") | |
for release in repo.get_releases(): | |
for asset in release.get_assets(): | |
print(asset.browser_download_url) | |
EOF | |
cat /tmp/artifacts.txt | |
mkdir -p $EXIV2WEB/../releases/ | |
(cd $EXIV2WEB/../releases/; while read url; do curl -sLO $url; done < /tmp/artifacts.txt) | |
mkdir -p $EXIV2WEB/builds | |
mv -v $EXIV2WEB/../releases/*-$(cat $EXIV2WEB/var/__version__)-* $EXIV2WEB/builds | |
# Generate the final static content | |
g++ $EXIV2WEB/bin/rssdate.cpp -o $EXIV2WEB/bin/rssdate | |
touch $EXIV2WEB/master/news.xml | |
make -C $EXIV2WEB update | |
make -C $EXIV2WEB | |
# Patch the generated content to point builds and releases to Github | |
while read url | |
do pkg=$(echo $url | grep -o 'exiv2-[^/]*$'); sed -i "s,/releases/$pkg,$url," $EXIV2WEB/html/archive.html | |
done < /tmp/artifacts.txt | |
for url in $(grep exiv2-$(cat $EXIV2WEB/var/__version__)- /tmp/artifacts.txt) | |
do pkg=$(echo $url | grep -o 'exiv2-[^/]*$'); sed -i "s,builds/$pkg,$url," $EXIV2WEB/html/download.html | |
done | |
# Cleanup | |
rm -fr /tmp/artifacts.txt $EXIV2WEB/html/releases $EXIV2WEB/html/builds | |
- name: Add CSS marker if pre-release | |
if: contains(matrix.EXIV2TAG, 'RC') | |
run: sed -E '/PreRelease.png/s/\/\*|\*\// /g' -i $EXIV2WEB/html/include/exiv2.css | |
- name: Deploy static content for exiv2.org | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.ref == 'refs/heads/main' && !contains(matrix.EXIV2TAG, 'RC') | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ${{ env.EXIV2WEB }}/html | |
publish_branch: gh-pages | |
cname: exiv2.org | |
- name: Deploy static content for pre-release.exiv2.org | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.ref == 'refs/heads/main' && contains(matrix.EXIV2TAG, 'RC') | |
with: | |
deploy_key: ${{ secrets.RC_DEPLOY_KEY }} | |
external_repository: Exiv2/pre-release.exiv2.org | |
publish_dir: ${{ env.EXIV2WEB }}/html | |
publish_branch: gh-pages | |
cname: pre-release.exiv2.org |