aboutsummaryrefslogtreecommitdiff
path: root/.gitea/workflows/release.yml
blob: 6f93b07db8e887860751b5e54574f8279c96a09c (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
84
85
86
87
88
89
90
name: release

on:
  push:
    tags: ["v*"]

jobs:
  dist:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: install autotools
        run: sudo apt-get update && sudo apt-get install -y autoconf automake
      - run: autoreconf -fi      
      - run: touch configure configure.ac aclocal.m4 Makefile.in
      - name: tag must match version in configure.ac
        run: |
          ver=$(./configure --version | head -1 | awk '{print $NF}')
          test "v$ver" = "$GITHUB_REF_NAME"
      - run: ./configure && make distcheck
      - uses: actions/upload-artifact@v3
        with:
          name: dist
          path: mikusays-*.tar.gz

  # linux binary, built from the tarball (so it tests what packagers get)
  build:
    needs: dist
    runs-on: ubuntu-latest
    steps:
      - name: install compiler
        run: sudo apt-get update && sudo apt-get install -y build-essential
      - uses: actions/download-artifact@v3
        with:
          name: dist
      - name: build and package
        run: |
          VERSION=${GITHUB_REF_NAME#v}
          tar xf mikusays-$VERSION.tar.gz
          cd mikusays-$VERSION
          ./configure LDFLAGS="-static"
          make
          strip mikusays
          ./mikusays -V
          ./mikusays "hi" > /dev/null
          mv mikusays ../mikusays-$VERSION-linux-x86_64
      - uses: actions/upload-artifact@v3
        with:
          name: bin-linux-x86_64
          path: mikusays-*-linux-x86_64

  build-windows:
    needs: dist
    runs-on: ubuntu-latest
    steps:
      - name: install compiler
        run: sudo apt-get update && sudo apt-get install -y build-essential gcc-mingw-w64-x86-64
      - uses: actions/download-artifact@v3
        with:
          name: dist
      - name: build and package
        run: |
          VERSION=${GITHUB_REF_NAME#v}
          tar xf mikusays-$VERSION.tar.gz
          cd mikusays-$VERSION
          ./configure --host=x86_64-w64-mingw32 LDFLAGS="-static"
          make
          x86_64-w64-mingw32-strip mikusays.exe
          mv mikusays.exe ../mikusays-$VERSION-windows-x86_64.exe
      - uses: actions/upload-artifact@v3
        with:
          name: bin-windows-x86_64
          path: mikusays-*-windows-x86_64.exe

  release:
    needs: [dist, build, build-windows]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@v3
        with:
          path: artifacts
      - name: checksums
        run: |
          cd artifacts
          find . -mindepth 2 -type f -exec mv {} . \;
          find . -type d -empty -delete
          sha256sum * > SHA256SUMS
      - uses: akkuman/gitea-release-action@v1
        with:
          files: artifacts/*