exiv2/.github/workflows/release.yml
Christoph Hasse f8962224fd fix: prevent creation of nightly release with draf==true
Sometime the nightly pre-release would be in "draft" status on github.
It's hard to reproduce but I had the guess that maybe the deletion of
old tag and release on the github side wasn't quite done when the
new release was being created. Of course only speculation...
But, moving the download of the artifacts in betweent these two steps
seems to have fixed the symptom.
2021-06-04 15:50:53 +02:00

233 lines
7.1 KiB
YAML

name: Release
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
schedule:
- cron: '30 4 * * *'
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: false
default: nightly
jobs:
Linux:
name: 'Build Linux Release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get install ninja-build
sudo apt-get install gettext
pip3 install conan==1.36.0
- name: Conan common config
run: |
conan profile new --detect default
conan profile update settings.build_type=Release default
conan profile update settings.compiler.libcxx=libstdc++11 default
- name: Run Conan
run: |
mkdir build && cd build
conan profile list
conan profile show default
conan install .. -o webready=False --build missing
- name: Build packaged release
run: |
cd build
cmake -GNinja -DEXIV2_TEAM_PACKAGING=ON -DBUILD_SHARED_LIBS=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_ENABLE_NLS=ON -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_BMFF=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON ..
cmake --build . -t package
tree -L 3
- uses: actions/upload-artifact@v2
with:
name: exiv2-linux64
path: ./build/exiv2-*.tar.gz
if-no-files-found: error
retention-days: 1
macOS:
name: 'Build macOS Release'
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
brew install ninja
brew install tree
brew install gettext
pip3 install conan==1.36.0
- name: Run Conan
run: |
mkdir build && cd build
conan profile new --detect default
conan profile show default
conan install .. -o webready=False --build missing
# Hack: Delete cmake_find_package generated files to fix compilation on mac.
rm Find*
- name: Build packaged release
run: |
cd build
cmake -GNinja -DEXIV2_TEAM_PACKAGING=ON -DBUILD_SHARED_LIBS=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_ENABLE_NLS=ON -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_BMFF=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" ..
cmake --build . -t package
tree -L 3
- uses: actions/upload-artifact@v2
with:
name: exiv2-macos
path: ./build/exiv2-*.tar.gz
if-no-files-found: error
retention-days: 1
Windows:
name: 'Build Windows Release'
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.0
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Restore conan cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/conanCache
key: ${{runner.os}}-packaged-win-release-${{ hashFiles('conanfile.py') }}
- name: Install Conan & Common config
run: |
pip.exe install conan
conan profile new --detect default
conan profile update settings.build_type=Release default
conan config set storage.path=$Env:GITHUB_WORKSPACE/conanCache
conan config get storage.path
tree /f ./conanCache
- name: Run Conan
run: |
md build
cd build
conan profile list
conan install .. --build missing
dir ..
tree /f ../conanCache
- name: Build packaged release
run: |
cd build
cmake -GNinja -DEXIV2_TEAM_PACKAGING=ON -DBUILD_SHARED_LIBS=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_ENABLE_NLS=OFF -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_BMFF=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON ..
cmake --build . -t package
tree -L 3
- uses: actions/upload-artifact@v2
with:
name: exiv2-win
path: ./build/exiv2-*.zip
if-no-files-found: error
retention-days: 1
publish:
needs: [Linux, macOS, Windows]
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'schedule'
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- if: env.TAG_NAME == 'nightly'
run: |
echo 'BODY<<EOF' >> $GITHUB_ENV
echo '## Exiv2 nightly prerelease build.' >> $GITHUB_ENV
echo 'Please help us improve exiv2 by reporting any issues you encounter :wink:' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- if: env.TAG_NAME != 'nightly'
run: |
echo 'BODY<<EOF' >> $GITHUB_ENV
echo '## Exiv2 Release ${{ env.TAG_NAME }}' >> $GITHUB_ENV
echo 'See [ChangeLog](doc/ChangeLog) for more information about the changes in this release.' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Cleanup old nightly
if: env.TAG_NAME == 'nightly'
uses: actions/github-script@v4
with:
script: |
try{
const rel_id = await github.repos.getReleaseByTag({
...context.repo,
tag: "nightly"
}).then(result => result.data.id);
console.log( "Found existing nightly release with id: ", rel_id);
await github.repos.deleteRelease({
...context.repo,
release_id: rel_id
});
console.log( "Deletion of release successful")
}catch(error){
console.log( "Deletion of release failed");
console.log( "Failed with error\n", error);
}
try{
await github.git.deleteRef({
...context.repo,
ref: "tags/nightly"
});
console.log( "Deletion of tag successful")
}catch(error){
console.log( "Deletion of tag failed");
console.log( "Failed with error\n", error);
}
- uses: actions/download-artifact@v2
- name: List downloaded files
run: tree -L 3
- uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# needs newer relase, but add it once available
#fail_on_unmatched_files: true
body: ${{ env.BODY }}
prerelease: ${{ env.TAG_NAME == 'nightly' }}
tag_name: ${{ env.TAG_NAME }}
files: |
./exiv2-linux64/exiv2-*
./exiv2-macos/exiv2-*
./exiv2-win/exiv2-*