aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/flatpak.yml
blob: 68ad21f3dcab03ad00ae32a006ea3fb0b63fe612 (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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: Flatpak

on:
  release:
    types: released

jobs:
  part1:
    name: Part 1/3
    if: github.repository == 'monero-project/monero-gui'
    runs-on: ubuntu-latest
    container:
      image: bilelmoussaoui/flatpak-github-actions:kde-5.15-22.08
      options: --privileged
    strategy:
      matrix:
        arch: [x86_64, aarch64]
    steps:
    - name: Checkout
      uses: actions/checkout@v3
      with:
        submodules: recursive

    - name: Install deps
      run: dnf -y install docker

    - name: Setup QEMU
      uses: docker/setup-qemu-action@v2
      with:
        platforms: arm64

    - name: Build flatpak
      uses: flatpak/flatpak-github-actions/flatpak-builder@v6
      env:
        FLATPAK_BUILDER_N_JOBS: 3
      with:
        manifest-path: share/org.getmonero.Monero.yaml
        arch: ${{ matrix.arch }}
        cache: false
        stop-at-module: boost

    - name: Tar flatpak-builder
      run: tar -cvf flatpak-builder.tar .flatpak-builder

    - name: Save flatpak-builder
      uses: actions/upload-artifact@v3
      with:
        name: flatpak-builder-${{ matrix.arch }}
        path: flatpak-builder.tar

  part2:
    name: Part 2/3
    if: github.repository == 'monero-project/monero-gui'
    needs: part1
    runs-on: ubuntu-latest
    container:
      image: bilelmoussaoui/flatpak-github-actions:kde-5.15-22.08
      options: --privileged
    strategy:
      matrix:
        arch: [x86_64, aarch64]
    steps:
    - name: Checkout
      uses: actions/checkout@v3

    - name: Install deps
      run: dnf -y install docker

    - name: Setup QEMU
      uses: docker/setup-qemu-action@v2
      with:
        platforms: arm64

    - name: Restore flatpak-builder
      uses: actions/download-artifact@v4.1.7
      with:
        name: flatpak-builder-${{ matrix.arch }}

    - name: Untar flatpak-builder
      run: tar -xvf flatpak-builder.tar

    - name: Build flatpak
      uses: flatpak/flatpak-github-actions/flatpak-builder@v6
      env:
        FLATPAK_BUILDER_N_JOBS: 3
      with:
        manifest-path: share/org.getmonero.Monero.yaml
        arch: ${{ matrix.arch }}
        cache: false
        stop-at-module: monero-gui

    - name: Tar flatpak-builder
      run: tar -cvf flatpak-builder.tar .flatpak-builder

    - name: Save flatpak-builder
      uses: actions/upload-artifact@v3
      with:
        name: flatpak-builder-${{ matrix.arch }}
        path: flatpak-builder.tar

  part3:
    name: Part 3/3
    if: github.repository == 'monero-project/monero-gui'
    needs: [part1, part2]
    runs-on: ubuntu-latest
    container:
      image: bilelmoussaoui/flatpak-github-actions:kde-5.15-22.08
      options: --privileged
    strategy:
      matrix:
        arch: [x86_64, aarch64]
    steps:
    - name: Checkout
      uses: actions/checkout@v3
      with:
        submodules: recursive

    - name: Add version and date
      run: |
        sed -i 's/<version>/${{ github.event.release.tag_name }}/g' $GITHUB_WORKSPACE/share/org.getmonero.Monero.metainfo.xml
        sed -i 's/<date>/'"$(date '+%F')"'/g' $GITHUB_WORKSPACE/share/org.getmonero.Monero.metainfo.xml

    - name: Install deps
      run: dnf -y install docker

    - name: Setup QEMU
      uses: docker/setup-qemu-action@v2
      with:
        platforms: arm64

    - name: Restore flatpak-builder
      uses: actions/download-artifact@v4.1.7
      with:
        name: flatpak-builder-${{ matrix.arch }}

    - name: Untar flatpak-builder
      run: tar -xvf flatpak-builder.tar

    - name: Build flatpak
      uses: flatpak/flatpak-github-actions/flatpak-builder@v6
      env:
        FLATPAK_BUILDER_N_JOBS: 3
      with:
        manifest-path: share/org.getmonero.Monero.yaml
        arch: ${{ matrix.arch }}
        cache: false

    - name: Validate AppData
      working-directory: flatpak_app/files/share/appdata
      run: appstream-util validate org.getmonero.Monero.appdata.xml

    - name: Delete flatpak-builder
      uses: geekyeggo/delete-artifact@v2
      with:
        name: flatpak-builder-${{ matrix.arch }}

    - name: Print hashes
      working-directory: flatpak_app/files/bin
      run: |
        echo "Hashes of the ${{ matrix.arch }} binaries:" >> $GITHUB_STEP_SUMMARY
        echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
        for bin in monero-blockchain-ancestry monero-blockchain-depth monero-blockchain-export monero-blockchain-import monero-blockchain-mark-spent-outputs monero-blockchain-prune monero-blockchain-prune-known-spent-data monero-blockchain-stats monero-blockchain-usage monerod monero-gen-ssl-cert monero-gen-trusted-multisig monero-wallet-cli monero-wallet-gui monero-wallet-rpc p2pool; do sha256sum $bin; done >> $GITHUB_STEP_SUMMARY
        echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
        echo "An example command to check hashes:" >> $GITHUB_STEP_SUMMARY
        echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
        echo "$ flatpak run --command=sha256sum org.getmonero.Monero /app/bin/monero-wallet-gui" >> $GITHUB_STEP_SUMMARY
        echo "\`\`\`" >> $GITHUB_STEP_SUMMARY

    - name: Publish to Flathub Beta
      uses: flatpak/flatpak-github-actions/flat-manager@v6
      with:
        flat-manager-url: https://hub.flathub.org
        repository: beta
        token: ${{ secrets.FLATHUB_ }}