|
| 1 | +name: Packaging(Linux - ARM) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - fix* |
| 8 | + - move-arm-ci-to-new-ci |
| 9 | + paths-ignore: |
| 10 | + - 'README.md' |
| 11 | + - 'LICENSE' |
| 12 | + - 'docs/**' |
| 13 | + |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +env: |
| 17 | + PRODUCT: flameshot |
| 18 | + RELEASE: 1 |
| 19 | + # dockerfiles, see https://github.com/flameshot-org/flameshot-dockerfiles |
| 20 | + # docker images, see https://quay.io/repository/flameshot-org/ci-building |
| 21 | + DOCKER_REPO: quay.io/flameshot-org/ci-building |
| 22 | + # building tool: https://github.com/flameshot-org/packpack |
| 23 | + PACKPACK_REPO: flameshot-org/packpack |
| 24 | + |
| 25 | +jobs: |
| 26 | + deb-pack: |
| 27 | + name: Build deb on ${{ matrix.dist.name }} ${{ matrix.dist.arch }} |
| 28 | + runs-on: ubuntu-latest |
| 29 | + strategy: |
| 30 | + fail-fast: false |
| 31 | + matrix: |
| 32 | + dist: |
| 33 | + - { |
| 34 | + name: debian-11, |
| 35 | + os: debian, |
| 36 | + symbol: bullseye, |
| 37 | + arch: armhf |
| 38 | + } |
| 39 | + - { |
| 40 | + name: debian-12, |
| 41 | + os: debian, |
| 42 | + symbol: bookworm, |
| 43 | + arch: arm64 |
| 44 | + } |
| 45 | + - { |
| 46 | + name: debian-12, |
| 47 | + os: debian, |
| 48 | + symbol: bookworm, |
| 49 | + arch: armhf |
| 50 | + } |
| 51 | + - { |
| 52 | + name: ubuntu-22.04, |
| 53 | + os: ubuntu, |
| 54 | + symbol: jammy, |
| 55 | + arch: amd64 |
| 56 | + } |
| 57 | + steps: |
| 58 | + - name: Set up Docker Buildx |
| 59 | + uses: docker/setup-buildx-action@v3 |
| 60 | + - name: Set up QEMU |
| 61 | + uses: docker/setup-qemu-action@v3 |
| 62 | + - name: Checkout Source code |
| 63 | + if: github.event_name == 'push' |
| 64 | + uses: actions/checkout@v4 |
| 65 | + with: |
| 66 | + fetch-depth: 0 |
| 67 | + ref: master |
| 68 | + - name: Checkout Source code |
| 69 | + if: github.event_name == 'pull_request' |
| 70 | + uses: actions/checkout@v4 |
| 71 | + with: |
| 72 | + fetch-depth: 0 |
| 73 | + ref: ${{ github.event.pull_request.head.sha }} |
| 74 | + - name: Set env & Print flameshot version |
| 75 | + shell: bash |
| 76 | + run: | |
| 77 | + last_committed_tag=$(git tag -l --sort=-v:refname | head -1) |
| 78 | + git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count) |
| 79 | + git_hash=$(git rev-parse --short HEAD) |
| 80 | + ver_info=${last_committed_tag}+git${git_revno}.${git_hash} |
| 81 | + echo "=======FLAMESHOT VERSION========" |
| 82 | + echo ${last_committed_tag:1} |
| 83 | + echo "Details: ${ver_info}" |
| 84 | + echo "================================" |
| 85 | + echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV |
| 86 | + echo "VER_INFO=${ver_info}" >> $GITHUB_ENV |
| 87 | + - name: Get packpack tool |
| 88 | + uses: actions/checkout@v4 |
| 89 | + with: |
| 90 | + repository: ${{ env.PACKPACK_REPO }} |
| 91 | + path: tools |
| 92 | + ref: multiarch |
| 93 | + set-safe-directory: $GITHUB_WORKSPACE/tools |
| 94 | + - name: Packaging on ${{ matrix.dist.name }} ${{ matrix.dist.arch }} |
| 95 | + env: |
| 96 | + OS: ${{ matrix.dist.os }} |
| 97 | + DIST: ${{ matrix.dist.symbol }} |
| 98 | + DOCKER_ARCH: ${{ matrix.dist.arch }} |
| 99 | + run: | |
| 100 | + case ${DOCKER_ARCH} in |
| 101 | + arm32v7) |
| 102 | + export ARCH=arm/v7 |
| 103 | + ;; |
| 104 | + armhf) |
| 105 | + export ARCH=arm/v7 |
| 106 | + ;; |
| 107 | + arm64*) |
| 108 | + export ARCH=arm64 |
| 109 | + ;; |
| 110 | + *) |
| 111 | + export ARCH=${DOCKER_ARCH} |
| 112 | + ;; |
| 113 | + esac |
| 114 | + cp -r $GITHUB_WORKSPACE/packaging/debian $GITHUB_WORKSPACE |
| 115 | + bash $GITHUB_WORKSPACE/tools/packpack |
| 116 | + mv $GITHUB_WORKSPACE/build/${PRODUCT}_${VERSION}-${RELEASE}_${{ matrix.dist.arch }}.deb $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb |
| 117 | + - name: SHA256Sum of ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package |
| 118 | + run: | |
| 119 | + cd "$GITHUB_WORKSPACE/build/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/build/'!"; exit 11 ; } |
| 120 | + sha256sum ${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb | tee ${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb.sha256sum |
| 121 | + - name: Artifact Upload |
| 122 | + uses: actions/upload-artifact@v4 |
| 123 | + with: |
| 124 | + name: ${{ env.PRODUCT }}-${{ env.VER_INFO }}-artifact-${{ matrix.dist.name }}-${{ matrix.dist.arch }} |
| 125 | + path: | |
| 126 | + ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-${{ env.RELEASE }}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb |
| 127 | + ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-${{ env.RELEASE }}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb.sha256sum |
| 128 | + overwrite: true |
| 129 | + |
| 130 | + |
0 commit comments