|
8 | 8 | runs-on: ubuntu-latest |
9 | 9 | permissions: |
10 | 10 | contents: write |
11 | | - |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + arch: [x86_64, aarch64] |
12 | 14 | steps: |
13 | 15 | - name: Checkout |
14 | 16 | uses: actions/checkout@v4 |
| 17 | + - name: Set up QEMU |
| 18 | + if: ${{ matrix.arch != 'x86_64' }} |
| 19 | + uses: docker/setup-qemu-action@v3 |
| 20 | + with: |
| 21 | + platforms: ${{ matrix.arch }} |
15 | 22 | - name: Install Flatpak |
16 | 23 | run: |
17 | 24 | | |
18 | | - sudo apt update |
19 | | - sudo apt upgrade -y |
20 | | - sudo apt install -y flatpak flatpak-builder |
| 25 | + sudo apt -qq update |
| 26 | + sudo apt -qq install -y flatpak flatpak-builder |
21 | 27 | sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo |
22 | | - sudo flatpak install -y org.freedesktop.Platform//23.08 |
23 | | - sudo flatpak install -y org.freedesktop.Sdk//23.08 |
| 28 | + sudo flatpak install --noninteractive --arch=${{ matrix.arch }} org.freedesktop.Platform//23.08 org.freedesktop.Sdk//23.08 |
24 | 29 | git config --global protocol.file.allow always # https://github.com/flatpak/flatpak-builder/issues/495 |
25 | 30 | - name: Build |
26 | 31 | run: |
27 | 32 | | |
28 | | - flatpak-builder build com.tencent.WeChat.yaml --delete-build-dirs --force-clean |
29 | | - flatpak-builder --repo=repo build com.tencent.WeChat.yaml --force-clean |
30 | | - flatpak build-bundle ./repo com.tencent.WeChat.flatpak com.tencent.WeChat |
31 | | - - name: Get current date |
32 | | - id: date |
33 | | - run: echo "CURRENT_DATE=$(date -u '+%y%m%d%H%M')" >> $GITHUB_OUTPUT |
| 33 | + flatpak-builder --arch=${{ matrix.arch }} --repo=repo build com.tencent.WeChat.yaml --delete-build-dirs --force-clean |
| 34 | + flatpak build-bundle --arch=${{ matrix.arch }} ./repo com.tencent.WeChat.flatpak com.tencent.WeChat |
| 35 | + mv com.tencent.WeChat.flatpak com.tencent.WeChat-${{ matrix.arch }}.flatpak |
34 | 36 | - name: Upload to Artifact |
35 | 37 | uses: actions/upload-artifact@v4 |
36 | 38 | with: |
37 | | - name: flatpak-bundle |
38 | | - path: com.tencent.WeChat.flatpak |
| 39 | + name: flatpak-bundle-${{ matrix.arch }} |
| 40 | + path: com.tencent.WeChat-${{ matrix.arch }}.flatpak |
| 41 | + |
| 42 | + upload-release: |
| 43 | + if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' |
| 44 | + runs-on: ubuntu-latest |
| 45 | + needs: build-bundle |
| 46 | + permissions: |
| 47 | + contents: write |
| 48 | + steps: |
| 49 | + - name: Checkout |
| 50 | + uses: actions/checkout@v4 |
| 51 | + - name: Install xmlstarlet |
| 52 | + run: sudo apt -qq update && sudo apt -qq install -y xmlstarlet |
| 53 | + - name: Download artifacts |
| 54 | + uses: actions/download-artifact@v4 |
| 55 | + with: |
| 56 | + merge-multiple: true |
| 57 | + - name: Get current date & version |
| 58 | + id: env |
| 59 | + run: |
| 60 | + | |
| 61 | + echo "CURRENT_DATE=$(date -u '+%y%m%d%H%M')" >> $GITHUB_OUTPUT |
| 62 | + echo "VERSION=$(xmlstarlet sel -t -v //component/releases/release[1]/@version com.tencent.WeChat.metainfo.xml)" >> $GITHUB_OUTPUT |
39 | 63 | - name: Upload to Release |
40 | | - if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' |
41 | 64 | uses: softprops/action-gh-release@v2 |
42 | 65 | with: |
43 | | - name: ${{ steps.date.outputs.CURRENT_DATE }} |
44 | | - tag_name: ${{ steps.date.outputs.CURRENT_DATE }} |
45 | | - files: com.tencent.WeChat.flatpak |
| 66 | + name: ${{ steps.env.outputs.VERSION }} |
| 67 | + tag_name: ${{ steps.env.outputs.VERSION }}-${{ steps.env.outputs.CURRENT_DATE }} |
| 68 | + files: com.tencent.WeChat-*.flatpak |
46 | 69 | body: |
47 | 70 | | |
48 | 71 | install via: |
49 | 72 | ``` |
50 | | - flatpak install com.tencent.WeChat.flatpak |
| 73 | + flatpak install com.tencent.WeChat-<arch>.flatpak |
51 | 74 | ``` |
0 commit comments