summaryrefslogtreecommitdiffstats
path: root/.github/workflows/release.yml
blob: 650f053292a7a2a09f4f794df6224797dd23fd52 (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
91
92
93
94
95
96
97
98
name: release
on:
  push:
    tags:
      - '*'
jobs:
  create-release:
    name: create-release
    runs-on: ubuntu-latest
    outputs:
      upload_url: ${{ steps.release.outputs.upload_url }}
      lnav_version_number: ${{ env.LNAV_VERSION_NUMBER }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
      - name: Make release notes
        run: make -C release release-NEWS.md
      - name: Get the release version from the tag
        shell: bash
        run: |
          # Apparently, this is the right way to get a tag name. Really?
          #
          # See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
          echo "LNAV_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
          echo "LNAV_VERSION_NUMBER=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
          echo "version is: ${{ env.LNAV_VERSION }}"
      - name: Create GitHub release
        id: release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ env.LNAV_VERSION }}
          release_name: ${{ env.LNAV_VERSION }}
          body_path: release/release-NEWS.md
          draft: true

  build-binaries:
    name: build-binaries
    needs: ['create-release']
    uses: ./.github/workflows/bins.yml
    secrets: inherit
    with:
      lnav_version_number: ${{ needs.create-release.outputs.lnav_version_number }}
      upload_url: ${{ needs.create-release.outputs.upload_url }}

  build-release:
    name: build-release
    needs: ['create-release']
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
      - name: Update apt
        run: sudo apt-get update
      - name: Install packages
        run: >-
          sudo apt-get install -y
          make
          automake
          autoconf
          g++
          libpcre2-dev
          libpcre3-dev
          libncurses-dev
          libsqlite3-dev
          libbz2-dev
          libcurl4-openssl-dev
          libreadline-dev
          zlib1g-dev
      - name: autogen
        run: ./autogen.sh
      - name: configure
        run: ./configure --disable-static
      - name: make dist
        run: >-
          make dist dist-bzip2 &&
          mv -n lnav-*.tar.gz lnav-${{ needs.create-release.outputs.lnav_version_number }}.tar.gz &&
          mv -n lnav-*.tar.bz2 lnav-${{ needs.create-release.outputs.lnav_version_number }}.tar.bz2
      - name: Upload tgz archive
        uses: actions/upload-release-asset@v1.0.2
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ needs.create-release.outputs.upload_url }}
          asset_path: lnav-${{ needs.create-release.outputs.lnav_version_number }}.tar.gz
          asset_name: lnav-${{ needs.create-release.outputs.lnav_version_number }}.tar.gz
          asset_content_type: application/octet-stream
      - name: Upload tbz2 archive
        uses: actions/upload-release-asset@v1.0.2
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ needs.create-release.outputs.upload_url }}
          asset_path: lnav-${{ needs.create-release.outputs.lnav_version_number }}.tar.bz2
          asset_name: lnav-${{ needs.create-release.outputs.lnav_version_number }}.tar.bz2
          asset_content_type: application/octet-stream