summaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: 3dd2bc020649ecfcf79374dbba3d0c563a322b8a (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
72
73
74
75
76
77
78
79
80
81
82
83
name: packages

on:
  push:
    tags:
      - 'v*.*.*'
  workflow_dispatch:

env:
  DEBEMAIL: jaakko.keranen@iki.fi
  DEBFULLNAME: Jaakko Keränen (skyjake)

jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: '0'
          submodules: 'recursive'
      - name: install-dependencies
        run: |
          git submodule sync
          sudo apt-get update -qq -y
          sudo apt-get install -y -qq --no-install-recommends cmake libsdl2-dev libssl-dev libpcre3-dev zlib1g-dev libunistring-dev libmpg123-dev debhelper dh-make devscripts fakeroot build-essential python3 python3-pip libharfbuzz-dev libfribidi-dev
          sudo pip3 install git-archive-all
      - name: import-signing-key
        run: |
          mkdir -p ~/.gnupg/
          printf "$GPG_SIGNING_KEY" | base64 --decode > ~/.gnupg/private.key
          gpg --import ~/.gnupg/private.key
        env:
          GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
      - name: package-build
        run: |
          export RELEASE_VERSION=`git tag | sort -rV | head -n1 | sed 's/v\(.*\)/\1/'`
          git archive-all --prefix=lagrange-${RELEASE_VERSION}/ lagrange-${RELEASE_VERSION}.tar.gz
          tar -xvzf lagrange-${RELEASE_VERSION}.tar.gz
          ln -s lagrange-${RELEASE_VERSION}.tar.gz lagrange_${RELEASE_VERSION}.orig.tar.gz
          cd lagrange-${RELEASE_VERSION}
          dch -v ${RELEASE_VERSION}-1 "Built by GitHub CI."
          dch -r ""
          debuild
          cd ..
          mkdir -p artifacts
          mv *deb artifacts/
        shell: bash
      - name: plain-build
        run: |
          export RELEASE_VERSION=`git tag | sort -rV | head -n1 | sed 's/v\(.*\)/\1/'`
          mkdir builddir
          cd builddir
          cmake .. -DCMAKE_BUILD_TYPE=Release
          cmake --build .
          mkdir -p ../artifacts/
          tar -czvf ../artifacts/lagrange-${RELEASE_VERSION}-linux-amd64.tar.gz lagrange
          cd ..
      - name: upload-artifact
        uses: actions/upload-artifact@v2
        with:
          name: lagrange_ubuntu-18.04
          path: artifacts
  debian_build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: '0'
          submodules: 'recursive'
      - name: get-repo-name
        run: |
          echo "REPOSITORY_NAME="$(echo $GITHUB_REPOSITORY | awk -F / '{print $2}' | sed -e "s/:refs//") >> $GITHUB_ENV
        shell: bash
      - name: install-dependencies
        run: |
          git submodule sync
      - name: debian_docker
        uses: ./.github/workflows/docker-debian/
      - name: upload-debian-artifact
        uses: actions/upload-artifact@v2
        with:
          name: lagrange_debian-buster
          path: /home/runner/work/${{env.REPOSITORY_NAME}}/${{env.REPOSITORY_NAME}}/artifacts