summaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: 266ab30102d0cd46a2c6cbfa3df30e26bf5f63fb (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
name: release

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

env:
    BUILD_TYPE: Release

jobs:
  build-and-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true

      - name: patch to libssh
        run: patch -d libssh -p1 < patch/libssh-0.10.4.patch

      # TODO: just building docker does not require packages. fix CMakeLists
      - name: install build dependency
        run: sudo ./scripts/install-build-deps.sh

      - name: Configure Cmake
        run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

      - name: Build Containers
        run: make -C ${{github.workspace}}/build docker-build-all

      - name: Test
        run: make -C ${{github.workspace}}/build docker-test-all

      - name: Retrieve packages from containers
        run: make -C ${{github.workspace}}/build docker-pkg-all

      - name: Copy mscp single binary built inside Alpine
        run: cp ${{github.workspace}}/build/mscp_alpine-3.17-x86_64.static ${{github.workspace}}/build/mscp.linux.x86.static

      - name: Release
        uses: softprops/action-gh-release@v1
        with:
          files: |
            ${{github.workspace}}/build/mscp_ubuntu-20.04-x86_64.deb
            ${{github.workspace}}/build/mscp_ubuntu-22.04-x86_64.deb
            ${{github.workspace}}/build/mscp_centos-8-x86_64.rpm
            ${{github.workspace}}/build/mscp_rocky-8.6-x86_64.rpm
            ${{github.workspace}}/build/mscp_alpine-3.17-x86_64.static
            ${{github.workspace}}/build/mscp.linux.x86.static

  source-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true

      - name: patch to libssh
        run: patch -d libssh -p1 < patch/libssh-0.10.4.patch

      - name: Set variables
        run: |
          VER=$(cat VERSION)
          echo "VERSION=$VER" >> $GITHUB_ENV

      - name: archive
        run: |
          cd ..
          cp -r mscp mscp-${{env.VERSION}}
          tar zcvf mscp-${{env.VERSION}}.tar.gz --exclude-vcs mscp-${{env.VERSION}}

      - name: Release
        uses: softprops/action-gh-release@v1
        with:
          files: |
            ${{github.workspace}}/../mscp-${{env.VERSION}}.tar.gz