|
| 1 | +--- |
| 2 | +name: Build kobo-ssh |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: build-kobo-ssh |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + filter-changes: |
| 16 | + name: Filter changes |
| 17 | + runs-on: ubuntu-latest |
| 18 | + outputs: |
| 19 | + toolchain_changed: ${{ steps.toolchain-changed-files.outputs.any_changed }} |
| 20 | + build_changed: ${{ steps.build-changed-files.outputs.any_changed }} |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Toolchain Changed Files |
| 26 | + id: toolchain-changed-files |
| 27 | + uses: tj-actions/changed-files@v45 |
| 28 | + with: |
| 29 | + files: | |
| 30 | + toolchain/** |
| 31 | +
|
| 32 | + - name: Build Changed Files |
| 33 | + id: build-changed-files |
| 34 | + uses: tj-actions/changed-files@v45 |
| 35 | + with: |
| 36 | + files: | |
| 37 | + .github/workflows/build.yaml |
| 38 | + KoboRoot/** |
| 39 | + compile.sh |
| 40 | +
|
| 41 | + build-toolchain-image: |
| 42 | + if: ${{ needs.filter-changes.outputs.toolchain_changed == 'true' }} |
| 43 | + name: Build toolchain image |
| 44 | + runs-on: ubuntu-latest |
| 45 | + permissions: |
| 46 | + contents: read |
| 47 | + packages: write |
| 48 | + steps: |
| 49 | + - name: Checkout |
| 50 | + uses: actions/checkout@v4 |
| 51 | + |
| 52 | + - name: Set up Docker Buildx |
| 53 | + uses: docker/setup-buildx-action@v3 |
| 54 | + |
| 55 | + - name: Login to image registry |
| 56 | + uses: docker/login-action@v3 |
| 57 | + with: |
| 58 | + registry: ghcr.io |
| 59 | + username: ${{ github.actor }} |
| 60 | + password: ${{ github.token }} |
| 61 | + |
| 62 | + - name: Docker meta |
| 63 | + id: meta |
| 64 | + uses: docker/metadata-action@v5 |
| 65 | + with: |
| 66 | + images: | |
| 67 | + ghcr.io/${{ github.repository_owner }}/kobo-ssh-toolchain |
| 68 | + tags: | |
| 69 | + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} |
| 70 | + type=ref,event=branch |
| 71 | + type=ref,event=tag |
| 72 | +
|
| 73 | + - name: Build image |
| 74 | + uses: docker/build-push-action@v6 |
| 75 | + id: build |
| 76 | + with: |
| 77 | + context: toolchain |
| 78 | + file: ./Dockerfile |
| 79 | + push: true |
| 80 | + tags: ${{ steps.meta.outputs.tags }} |
| 81 | + labels: ${{ steps.meta.outputs.labels }} |
| 82 | + cache-from: type=gha |
| 83 | + cache-to: type=gha,mode=max |
| 84 | + |
| 85 | + build-koboroot: |
| 86 | + if: ${{ needs.filter-changes.outputs.build_changed == 'true' }} |
| 87 | + name: Build KoboRoot |
| 88 | + runs-on: ubuntu-latest |
| 89 | + needs: |
| 90 | + - filter-changes |
| 91 | + - build-toolchain-image |
| 92 | + permissions: |
| 93 | + contents: read |
| 94 | + packages: read |
| 95 | + env: |
| 96 | + TOOLCHAIN_IMAGE: ghcr.io/${{ github.repository_owner }}/kobo-ssh-toolchain:latest |
| 97 | + DROPBEAR_TAG: DROPBEAR_2025.87 |
| 98 | + OPENSSH_TAG: V_9_9_P2 |
| 99 | + steps: |
| 100 | + - name: Checkout |
| 101 | + uses: actions/checkout@v4 |
| 102 | + |
| 103 | + - name: Clone dropbear sources |
| 104 | + run: | |
| 105 | + git clone --depth 1 --branch "${{ env.DROPBEAR_TAG }}" https://github.com/mkj/dropbear.git external/dropbear |
| 106 | +
|
| 107 | + - name: Build dropbear |
| 108 | + uses: kohlerdominik/docker-run-action@v2 |
| 109 | + with: |
| 110 | + image: ${{ env.TOOLCHAIN_IMAGE }} |
| 111 | + volumes: | |
| 112 | + ${{ github.workspace }}:/workspace |
| 113 | + workdir: /workspace |
| 114 | + run: | |
| 115 | + export PATH="/root/x-tools/arm-kobo-linux-gnueabihf/bin:$PATH" |
| 116 | + autoconf |
| 117 | + autoheader |
| 118 | + ./configure --host=arm-kobo-linux-gnueabihf --disable-zlib --disable-zlib CC="arm-kobo-linux-gnueabihf"-gcc LD="arm-kobo-linux-gnueabihf"-ld --disable-wtmp --disable-lastlog --disable-syslog --disable-utmpx --disable-utmp --disable-wtmpx --disable-loginfunc --disable-pututxline --disable-pututline --enable-bundled-libtom --disable-pam |
| 119 | + make clean |
| 120 | + make PROGRAMS="dropbear dropbearkey" MULTI=1 |
0 commit comments