-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically create a release when version changes in CMakeLists
- Loading branch information
Showing
1 changed file
with
49 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ jobs: | |
cmake .. -DWITH_VIDEO_DECODING=On -DWITH_VIDEO_DEVICE=On -DWITH_OPENSLIDE_SUPPORT=On -DWITH_STB_IMAGE=On -DWITH_LIBSIXEL=On | ||
make -k | ||
AppImage: | ||
AppImageBuild: | ||
runs-on: ubuntu-latest | ||
name: Build AppImage | ||
steps: | ||
|
@@ -118,8 +118,6 @@ jobs: | |
name: timg-${{ env.PACKAGE_VERSION }}-x86_64.AppImage | ||
path: timg-${{ env.PACKAGE_VERSION }}-x86_64.AppImage | ||
|
||
# TODO: upload to release | ||
|
||
CodeFormatting: | ||
if: false # currently, there is no clang-format-13 in ubuntu latest | ||
runs-on: ubuntu-latest | ||
|
@@ -137,3 +135,51 @@ jobs: | |
- name: Run formatting style check | ||
run: ./.github/bin/run-clang-format.sh | ||
|
||
TagAndRelease: | ||
needs: [ AppImage ] | ||
name: Version Tagging | ||
runs-on: ubuntu-latest | ||
#if: ${{github.event_name == 'push' && github.ref == 'refs/heads/main'}} | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: 📥 Download artifacts | ||
uses: actions/download-artifact@v3 | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Tag with CMake version if not already. | ||
run: | | ||
git config --local user.name "Development Bot" | ||
git config --local user.email "[email protected]" | ||
# We want to tag whenever the cmake version changes. So extract the | ||
# hash of when the current version was entered. | ||
read TAG_HASH TAG_VERSION <<<$(git annotate -l CMakeLists.txt | sed 's/\(^[0-9A-Fa-f]\+\).*project(timg VERSION \([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1 \2/p;d') | ||
echo "timg Version v${TAG_VERSION} at hash ${TAG_HASH}" | ||
# If this is the first time we see this tag: apply. | ||
if [ -z "$(git tag -l "v${TAG_VERSION}")" ]; then | ||
git tag -a "v${TAG_VERSION}" ${TAG_HASH} -m "Update to v${TAG_VERSION}" | ||
git push origin "v${TAG_VERSION}" | ||
echo "RELEASE_TAG=v${TAG_VERSION}" >> $GITHUB_ENV | ||
else | ||
echo "Tag does exist already" | ||
fi | ||
- name: 🎉 Release If Tagged | ||
if ${{ env.RELEASE_TAG != '' }} | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: artifact/timg-*.AppImage | ||
tag: ${{ env.RELEASE_TAG }} | ||
overwrite: true | ||
file_glob: true | ||
prerelease: true |