Merge pull request #785 from lr42/gh-pages #2038
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://docs.github.com/en/actions/learn-github-actions/contexts | |
--- | |
name: Gittyup | |
on: | |
push: | |
pull_request: | |
page_build: | |
workflow_dispatch: | |
env: | |
IS_RELEASE: ${{ github.event_name == 'push' && github.ref_type == 'tag' && startswith(github.ref_name, 'gittyup_v') }} | |
jobs: | |
flatpak: | |
name: "Flatpak" | |
runs-on: ubuntu-latest | |
container: | |
image: bilelmoussaoui/flatpak-github-actions:kde-5.15-21.08 | |
options: --privileged | |
steps: | |
- name: Show environment variables | |
run: > | |
echo IS_RELEASE: ${{ env.IS_RELEASE }} | |
# https://stackoverflow.com/questions/60916931/github-action-does-the-if-have-an-else | |
- name: Determine flatpak release branch | |
uses: haya14busa/action-cond@v1 | |
id: flatpak_release_branch | |
with: | |
cond: ${{ env.IS_RELEASE }} | |
if_true: 'stable' | |
if_false: 'development' | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Clone flatpak manifest from Flathub | |
uses: GuillaumeFalourd/clone-github-repo-action@v1 | |
with: | |
owner: 'flathub' | |
repository: 'com.github.Murmele.Gittyup' | |
- name: Replace git tag by the commit id on which it runs | |
if: github.ref_type != 'tag' | |
run: > | |
sed -i 's@tag: gittyup_v[1-9]*.[0-9]*.[0-9]*@commit: "${{ github.sha }}"@' com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml | |
- name: Use correct git tag | |
if: github.ref_type == 'tag' | |
run: > | |
sed -i 's@tag: .*$@tag: "${{ github.ref_name }}"@' com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml | |
- name: Replace source url | |
run: > | |
sed -i "s@url: .*Gittyup.git@url: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY@" com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml | |
- name: Add dev build marker to cmake options | |
if: github.ref_type != 'tag' | |
run: > | |
sed -i 's@config-opts: \["\(.*\)"\]@config-opts: ["\1", "-DDEV_BUILD=${{ github.ref_name }}"]@' com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml | |
- name: Replace desktop file name suffix | |
if: github.ref_type != 'tag' | |
run: > | |
sed -i 's@desktop-file-name-suffix: ""@desktop-file-name-suffix: " (Development)"@' com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml | |
- name: Show Flatpak manifest | |
run: cat com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml | |
- name: Build package | |
uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4 | |
with: | |
bundle: Gittyup.flatpak | |
manifest-path: com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml | |
cache: false | |
branch: ${{ steps.flatpak_release_branch.outputs.value }} | |
- name: Publish build artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
path: com.github.Murmele.Gittyup/* | |
name: Gittyup Flatpak | |
build: | |
runs-on: ${{ matrix.env.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
qt: | |
- version: 5.15.2 | |
check_only: false | |
- version: 5.12.0 | |
check_only: true | |
env: | |
- name: linux | |
os: ubuntu-latest | |
ninja_platform: linux | |
qt_platform: linux | |
openssl_arch: linux-x86_64 | |
cmake_env: {} | |
#- name: mac | |
#os: macos-latest | |
#ninja_platform: mac | |
#qt_platform: mac | |
#openssl_arch: darwin64-x86_64-cc | |
#cmake_env: {} | |
#pack: 1 | |
- name: win64 | |
os: windows-latest | |
ninja_platform: win | |
qt_platform: windows | |
qt_arch: win64_msvc2019_64 | |
qt_arch_check_only: win64_msvc2017_64 | |
openssl_arch: VC-WIN64A | |
msvc_arch: x64 | |
cmake_env: | |
CC: cl | |
CXX: cl | |
pack: 1 | |
- name: win32 | |
os: windows-latest | |
ninja_platform: win | |
qt_platform: windows | |
qt_arch: win32_msvc2019 | |
qt_arch_check_only: win32_msvc2017 | |
openssl_arch: VC-WIN32 | |
msvc_arch: x86 | |
cmake_env: | |
CC: cl | |
CXX: cl | |
pack: 1 | |
steps: | |
- name: Configure development build | |
if: github.ref_type != 'tag' | |
uses: allenevans/set-env@c4f231179ef63887be707202a295d9cb1c687eb9 | |
with: | |
CMAKE_FLAGS: '-DDEV_BUILD="${{ github.ref_name }}"' | |
- name: Checkout repository | |
uses: actions/checkout@v1 | |
- name: Initialize Submodules | |
uses: snickerbockers/submodules-init@v4 | |
- name: Install Perl | |
if: matrix.env.ninja_platform == 'win' | |
uses: shogo82148/actions-setup-perl@v1 | |
with: | |
perl-version: '5.30' | |
- name: Install Qt | |
uses: jurplel/[email protected] | |
timeout-minutes: 10 | |
if: "!matrix.qt.check_only" | |
with: | |
version: ${{ matrix.qt.version }} | |
target: desktop | |
host: ${{ matrix.env.qt_platform }} | |
arch: ${{ matrix.env.qt_arch }} | |
install-deps: true | |
modules: qtwebengine | |
- name: Install Qt | |
uses: jurplel/[email protected] | |
timeout-minutes: 10 | |
if: matrix.qt.check_only | |
with: | |
version: ${{ matrix.qt.version }} | |
target: desktop | |
host: ${{ matrix.env.qt_platform }} | |
arch: ${{ matrix.env.qt_arch_check_only }} | |
install-deps: true | |
modules: qtwebengine | |
- name: Install Ninja | |
uses: seanmiddleditch/gha-setup-ninja@v3 | |
with: | |
version: 1.9.0 | |
platform: ${{ matrix.env.ninja_platform }} | |
destination: ninja | |
- name: Setup MSVC environment | |
if: matrix.env.ninja_platform == 'win' | |
uses: seanmiddleditch/gha-setup-vsdevenv@v3 | |
with: | |
arch: ${{ matrix.env.msvc_arch }} | |
- name: Install NASM | |
if: matrix.env.ninja_platform == 'win' | |
uses: ilammy/[email protected] | |
- name: Build OpenSSL (linux) | |
if: matrix.env.ninja_platform == 'linux' | |
run: | | |
cd dep/openssl/openssl | |
./config -fPIC | |
make | |
- name: Build OpenSSL (mac) | |
if: matrix.env.ninja_platform == 'mac' | |
run: | | |
cd dep/openssl/openssl | |
./Configure ${{ matrix.env.openssl_arch }} no-shared | |
make | |
- name: Build OpenSSL (win) | |
if: matrix.env.ninja_platform == 'win' | |
run: | | |
cd dep/openssl/openssl | |
perl Configure ${{ matrix.env.openssl_arch }} | |
nmake | |
- name: Configure Release | |
env: ${{ matrix.env.cmake_env }} | |
run: | | |
mkdir -p build/release | |
cd build/release | |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ${{ env.CMAKE_FLAGS }} ../.. | |
- name: Build Information | |
run: | | |
echo "ninja version: $(ninja --version)" | |
git --version | |
qmake --version | |
cmake --version | |
- name: Build | |
run: | | |
cd build/release | |
ninja package | |
- name: Publish build artifacts | |
if: matrix.env.pack && !matrix.qt.check_only | |
uses: actions/upload-artifact@v2 | |
with: | |
path: build/release/pack/Gittyup-* | |
name: Gittyup ${{ matrix.env.name }} | |
- name: Publish version file | |
if: matrix.env.pack && !matrix.qt.check_only | |
uses: actions/upload-artifact@v2 | |
with: | |
path: build/release/VERSION.txt | |
name: Gittyup-VERSION | |
- name: Test | |
# TODO: Re-Enable this when https://github.com/actions/runner/issues/1206 gets resolved | |
if: matrix.env.ninja_platform != 'win' | |
continue-on-error: true | |
run: | | |
cd build/release | |
ninja check | |
publish: | |
# https://github.com/marvinpinto/actions/issues/177 | |
needs: [flatpak, build] | |
runs-on: ubuntu-latest # does not matter which | |
# a prerelase is created when pushing to master | |
# a release is created when a tag will be set | |
# last condition is the same as IS_RELEASE, | |
# but environment variables cannot be used outside of steps | |
# so it was copied to here too | |
if: ${{ github.ref == 'refs/heads/master' || (github.event_name == 'push' && github.ref_type == 'tag' && startswith(github.ref_name, 'gittyup_v')) }} | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
path: artifacts | |
- name: list artifacts folder | |
run: | | |
echo "Show artifacts folder:" | |
ls artifacts | |
echo "Show artifacts/Gittyup Flatpak folder:" | |
ls "artifacts/Gittyup Flatpak" | |
echo "Show artifacts/Gittyup-x86_64:" | |
ls "artifacts/Gittyup-x86_64" | |
echo "Show artifacts/Gittyup VERSION" | |
ls "artifacts/Gittyup-VERSION" | |
# version is exported from cmake to file | |
- name: Retrieve version | |
run: | | |
echo "::set-output name=VERSION::$(cat artifacts/Gittyup-VERSION/VERSION.txt)" | |
id: version | |
- name: Determine release title | |
uses: haya14busa/action-cond@v1 | |
id: release_title | |
with: | |
cond: ${{ env.IS_RELEASE }} | |
if_true: 'Gittyup Release ${{ steps.version.outputs.VERSION }}' | |
if_false: 'Latest Build (Development)' | |
- name: Determine release tag | |
uses: haya14busa/action-cond@v1 | |
id: release_tag | |
with: | |
cond: ${{ env.IS_RELEASE }} | |
if_true: 'stable' | |
if_false: 'latest' | |
- name: Update GitHub release | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
prerelease: ${{ !env.IS_RELEASE }} | |
title: ${{ steps.release_title.outputs.value }} | |
automatic_release_tag: ${{ steps.release_tag.outputs.value }} | |
files: | | |
**/artifacts/Gittyup win64/Gittyup*.exe | |
**/artifacts/Gittyup win32/Gittyup*.exe | |
**/artifacts/Gittyup Flatpak/com.github.Murmele.Gittyup.yml | |
**/Gittyup-x86_64/*.flatpak | |
... |