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: 0.27-nightly jobs: Linux: name: 'Build Linux Release' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Install dependencies run: | sudo apt-get install ninja-build gettext doxygen graphviz pip3 install conan==1.59.0 - name: Conan common config run: | conan config install https://github.com/conan-io/conanclientcert.git 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 -DEXIV2_BUILD_DOC=ON .. cmake --build . --target doc cmake --build . --target package tree -L 3 - uses: actions/upload-artifact@v3 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@v3 - name: Install dependencies run: | brew install ninja tree gettext doxygen graphviz - name: Build packaged release run: | mkdir build && 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 -DEXIV2_BUILD_DOC=ON -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" .. cmake --build . --target doc cmake --build . --target package tree -L 3 - uses: actions/upload-artifact@v3 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@v3 - 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@v3 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 doxygen run: | choco install doxygen.install choco install graphviz - name: Install Conan & Common config run: | pip.exe install "conan==1.59.0" conan config install https://github.com/conan-io/conanclientcert.git 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 -DEXIV2_BUILD_DOC=ON .. cmake --build . --target doc cmake --build . --target package tree -L 3 - uses: actions/upload-artifact@v3 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=0.27-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 == '0.27-nightly' run: | echo 'BODY<> $GITHUB_ENV echo '## Exiv2 0.27-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 != '0.27-nightly' run: | echo 'BODY<> $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 0.27-nightly if: env.TAG_NAME == '0.27-nightly' uses: actions/github-script@v6 with: script: | try{ const rel_id = await github.repos.getReleaseByTag({ ...context.repo, tag: "0.27-nightly" }).then(result => result.data.id); console.log( "Found existing 0.27-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/0.27-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@v3 - 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 == '0.27-nightly' }} tag_name: ${{ env.TAG_NAME }} files: | ./exiv2-linux64/exiv2-* ./exiv2-macos/exiv2-* ./exiv2-win/exiv2-*