name: Release concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true 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-22.04 steps: - uses: actions/checkout@v3 - name: Install dependencies run: | sudo apt-get install ninja-build gettext doxygen graphviz pip3 install conan==1.54.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: | cmake --preset linux-all -S . -B build -DEXIV2_TEAM_PACKAGING=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_ENABLE_CURL=OFF cmake --build build -t doc cmake --build build -t package - 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 brew install inih brew install tree brew install gettext brew install doxygen brew install graphviz - name: Build packaged release run: | mkdir build cmake -GNinja -S . -B build \ -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_INTERPROCEDURAL_OPTIMIZATION=ON \ -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" cmake --build build -t doc cmake --build build -t package - 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-2022 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: Install doxygen run: | choco install doxygen.install choco install graphviz - name: Restore conan cache uses: actions/cache@v2 with: path: ${{github.workspace}}/conanCache key: ${{runner.os}}-release-win-${{ hashFiles('conanfile.py') }} - name: Install Conan & Common config run: | pip.exe install "conan==1.54.0" conan profile new --detect default conan profile show default conan profile update settings.build_type=Release default conan profile update settings.compiler="Visual Studio" default conan profile update settings.compiler.version=17 default conan config set storage.path=$Env:GITHUB_WORKSPACE/conanCache - name: Run Conan run: | md build cd build conan install .. --build missing - name: Build packaged release run: | cmake --preset win-release -S . -B build -DEXIV2_TEAM_PACKAGING=ON -DEXIV2_BUILD_DOC=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_ENABLE_CURL=OFF cmake --build build --parallel -t doc cmake --build build --parallel -t package - 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-22.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<> $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<> $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@v6 with: script: | try{ const rel_id = await github.rest.repos.getReleaseByTag({ ...context.repo, tag: "nightly" }).then(result => result.data.id); console.log( "Found existing nightly release with id: ", rel_id); await github.rest.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.rest.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@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 == 'nightly' }} tag_name: ${{ env.TAG_NAME }} files: | ./exiv2-linux64/exiv2-* ./exiv2-macos/exiv2-* ./exiv2-win/exiv2-*