1name: Packaging
2
3on:
4  push:
5    tags:
6      - "*"
7
8jobs:
9
10  Release:
11    name: Release
12    runs-on: windows-latest
13    outputs:
14      upload_url: ${{ steps.create_release.outputs.upload_url }}
15
16    steps:
17      - uses: actions/checkout@v2
18      - name: Create Release
19        id: create_release
20        uses: actions/create-release@v1
21        env:
22          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23        with:
24          tag_name: ${{ github.ref }}
25          release_name: Release ${{ github.ref }}
26          body_path: ./NEWS.md
27          draft: false
28          prerelease: false
29
30  MSVC:
31    name: MSVC
32    runs-on: windows-latest
33    needs: Release
34
35    steps:
36      - name: Checkout
37        uses: actions/checkout@v2
38        with:
39          submodules: true
40
41      - name: Cache Qt
42        id: cache-qt
43        uses: actions/cache@v1
44        with:
45          path: ../Qt
46          key: ${{ runner.os }}-QtCache
47
48      - name: Install Qt
49        uses: jurplel/install-qt-action@v2
50        with:
51          version: 5.15.2
52          cached: ${{ steps.cache-qt.outputs.cache-hit }}
53
54      - uses: lukka/run-vcpkg@v6
55        with:
56          vcpkgGitCommitId: 50ea8c0ab7aca3bb9245bba7fc877ad2f2a4464c
57          setupOnly: true
58      - name: Install VCPKG packages
59        run: |
60          Add-Content ${{ env.VCPKG_ROOT }}\triplets\x64-windows.cmake "set(VCPKG_BUILD_TYPE release)"
61          ${{ env.VCPKG_ROOT }}\vcpkg install zlib gsl muparser opengl gl2ps gtest --triplet x64-windows
62
63      - name: Configuring
64        run: |
65          mkdir build; cd build
66          cmake .. -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}\scripts\buildsystems\vcpkg.cmake `
67            -DORIGIN_IMPORT=ON -DRUNTIME_DIR=${{ env.VCPKG_ROOT }}/installed/x64-windows/bin `
68            -DCPACK_PACKAGE_FILE_NAME=scidavis
69
70      - name: Building
71        run: |
72          cmake --build build --config Release -- -maxCpuCount
73
74      - name: Testing
75        run: |
76          cd build
77          ctest -C Release --output-on-failure
78
79      - name: Packaging
80        id: packaging
81        continue-on-error: true
82        run: |
83          $Env:version = (git describe --tags)
84          $Env:version
85          echo "::set-output name=version::$Env:version"
86          cd build
87          cpack -G WIX
88          cpack -G NSIS
89
90      - name: Upload MSI installer
91        continue-on-error: true
92        uses: actions/upload-release-asset@v1
93        env:
94          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95        with:
96          upload_url: ${{ needs.Release.outputs.upload_url }}
97          asset_path: build/scidavis.msi
98          asset_name: scidavis-${{ steps.packaging.outputs.version }}-win64.msi
99          asset_content_type: application/zip
100
101      - name: Upload NSIS installer
102        continue-on-error: true
103        uses: actions/upload-release-asset@v1
104        env:
105          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106        with:
107          upload_url: ${{ needs.Release.outputs.upload_url }}
108          asset_path: build/scidavis.exe
109          asset_name: scidavis-${{ steps.packaging.outputs.version }}-win64.exe
110          asset_content_type: application/zip
111