aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: e5ba11383ad64731266f2b21149d26235c79da2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Build
on:
  push:
    tags:
      - 'v*'

permissions:
  contents: write # Needed to write to GitHub draft release

env:
  NORTHSTAR_VERSION: ${{ github.ref_name }}

jobs:
  build-launcher:
    runs-on: windows-2022
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Setup msvc
        uses: ilammy/msvc-dev-cmd@v1
      - name: Configure cmake
        run: cmake -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Release"
      - name: Setup resource file version
        shell: bash
        run: |
          sed -i 's/DEV/${{ env.NORTHSTAR_VERSION }}/g' NorthstarLauncher/resources.rc
          FILEVERSION=$(echo ${{ env.NORTHSTAR_VERSION }} | tr '.' ',' | sed -E 's/-rc[0-9]+//' | tr -d '[:alpha:]')
          sed -i "s/0,0,0,1/${FILEVERSION}/g" NorthstarDLL/ns_version.h
      - name: Build
        run: cmake --build .
      - name: Upload launcher build as artifact
        uses: actions/upload-artifact@v3
        with:
          name: northstar-launcher
          path: |
            game/
      - name: Upload debug build artifact
        uses: actions/upload-artifact@v3
        with:
          name: launcher-debug-files
          path: |
            game/*.pdb
            game/bin/x64_retail/*.pdb

  upload-launcher-to-release:
    if: startsWith(github.ref, 'refs/tags/v')
    needs: build-launcher
    runs-on: ubuntu-22.04
    steps:
      - name: Download compiled launcher
        uses: actions/download-artifact@v3
        with:
          name: northstar-launcher
          path: northstar-launcher
      - name: Download compiled launcher
        uses: actions/download-artifact@v3
        with:
          name: launcher-debug-files
          path: launcher-debug-files
      - name: Create zip to upload
        run: |
          zip --recurse-paths --quiet --junk-paths northstar-launcher.zip northstar-launcher/
          zip --recurse-paths --quiet --junk-paths launcher-debug-files.zip launcher-debug-files/
      - name: Upload files to release
        uses: softprops/action-gh-release@v1
        with:
          body: ":warning: These are development files! If you want to download Northstar, [go here instead](https://github.com/R2Northstar/Northstar/releases) :warning:"
          draft: false
          files: |
            northstar-launcher.zip
            launcher-debug-files.zip