|
5 | 5 | push: |
6 | 6 | branches: |
7 | 7 | - ci |
| 8 | + tags: |
| 9 | + - '*' # build & release on any tag push, e.g. v1.2.3 |
8 | 10 | schedule: |
9 | 11 | - cron: "0 0 * * 0" |
10 | 12 |
|
| 13 | +permissions: |
| 14 | + contents: write # required to create releases |
| 15 | + |
11 | 16 | jobs: |
12 | 17 | build: |
13 | 18 | strategy: |
14 | 19 | matrix: |
15 | 20 | config: |
16 | | - - arch: x86-64 |
17 | | - config: ARCH=x86-64 PREFIX=/opt/openssh __all__/VERSION=latest |
18 | | - description: x86-64 |
19 | | - |
20 | | - - arch: x86-64 |
21 | | - config: ARCH=x86-64 PREFIX=/opt/openssh SHRINK=SHRINK_LEVEL_RUNTIME __all__/VERSION=latest |
22 | | - description: x86-64-small |
23 | | - |
24 | | - - arch: armv7-eabihf |
25 | | - config: ARCH=armv7-eabihf PREFIX=/system/opt/openssh __all__/VERSION=latest |
26 | | - description: armv7-eabihf-android |
27 | | - |
28 | | - - arch: armv7-eabihf |
29 | | - config: ARCH=armv7-eabihf PREFIX=/opt/openssh __all__/VERSION=latest |
30 | | - description: armv7-eabihf |
31 | | - |
32 | | - - arch: armv7-eabihf |
33 | | - config: ARCH=armv7-eabihf PREFIX=/opt/openssh SHRINK=SHRINK_LEVEL_RUNTIME __all__/VERSION=latest |
34 | | - description: armv7-eabihf-small |
35 | | - |
36 | | - - arch: aarch64 |
37 | | - config: ARCH=aarch64 PREFIX=/system/opt/openssh __all__/VERSION=latest |
38 | | - description: aarch64-android |
| 21 | + - arch: x86_64 |
| 22 | + config: ARCH=x86-64 PREFIX=/openssh SHRINK=SHRINK_LEVEL_RUNTIME __all__/VERSION=latest |
| 23 | + description: x86_64-small |
39 | 24 |
|
40 | 25 | - arch: aarch64 |
41 | | - config: ARCH=aarch64 PREFIX=/opt/openssh __all__/VERSION=latest |
42 | | - description: aarch64 |
43 | | - |
44 | | - - arch: aarch64 |
45 | | - config: ARCH=aarch64 PREFIX=/opt/openssh SHRINK=SHRINK_LEVEL_RUNTIME __all__/VERSION=latest |
| 26 | + config: ARCH=aarch64 PREFIX=/openssh SHRINK=SHRINK_LEVEL_RUNTIME __all__/VERSION=latest |
46 | 27 | description: aarch64-small |
47 | 28 |
|
48 | 29 | env: |
|
55 | 36 | uses: actions/checkout@v4 |
56 | 37 |
|
57 | 38 | - name: Install dependencies |
58 | | - run: sudo apt update && sudo apt install -y upx |
| 39 | + run: sudo apt update && sudo apt install -y upx zip |
59 | 40 |
|
60 | 41 | - name: Get number of CPU cores |
61 | 42 | uses: SimenB/github-actions-cpu-cores@v2 |
|
72 | 53 | name: ssh-binaries-for-${{ matrix.config.description }} |
73 | 54 | path: | |
74 | 55 | output/${{ matrix.config.arch }}/bin/ |
| 56 | +
|
| 57 | + release: |
| 58 | + name: Create GitHub Release (on tag) |
| 59 | + needs: build |
| 60 | + runs-on: ubuntu-24.04 |
| 61 | + if: startsWith(github.ref, 'refs/tags/') # only run this job for tag pushes |
| 62 | + |
| 63 | + steps: |
| 64 | + - name: Download all build artifacts |
| 65 | + uses: actions/download-artifact@v4 |
| 66 | + with: |
| 67 | + path: dist |
| 68 | + # NOTE: keep merge-multiple:false (default) so each artifact has its own subdir |
| 69 | + |
| 70 | + - name: Package per-arch into archives |
| 71 | + shell: bash |
| 72 | + run: | |
| 73 | + set -euo pipefail |
| 74 | + TAG="${GITHUB_REF_NAME}" # e.g. v1.2.3 |
| 75 | + mkdir -p release |
| 76 | +
|
| 77 | + # For each artifact directory (e.g., "ssh-binaries-for-x86-64-small") |
| 78 | + for artifact_dir in dist/*; do |
| 79 | + [ -d "$artifact_dir" ] || continue |
| 80 | +
|
| 81 | + # Derive a friendly arch label from the artifact name |
| 82 | + # Expecting artifact names like "ssh-binaries-for-x86-64-small" |
| 83 | + base="$(basename "$artifact_dir")" |
| 84 | + arch="${base#ssh-binaries-for-}" # => x86-64-small, aarch64-small, etc. |
| 85 | +
|
| 86 | + # Ensure the structure contains bin/ |
| 87 | + if [ ! -d "$artifact_dir/bin" ]; then |
| 88 | + echo "WARN: $artifact_dir has no bin/ directory; skipping" |
| 89 | + continue |
| 90 | + fi |
| 91 | +
|
| 92 | + # Compose archive names |
| 93 | + PKG_TGZ="openssh-static-${arch}-${TAG}.tar.gz" |
| 94 | + PKG_ZIP="openssh-static-${arch}-${TAG}.zip" |
| 95 | +
|
| 96 | + # Create .tar.gz with bin/ contents |
| 97 | + tar -C "$artifact_dir" -czf "release/${PKG_TGZ}" bin |
| 98 | +
|
| 99 | + # Create .zip with bin/ contents |
| 100 | + (cd "$artifact_dir" && zip -r "../../release/${PKG_ZIP}" bin > /dev/null) |
| 101 | +
|
| 102 | + done |
| 103 | +
|
| 104 | + # Generate SHA256SUMS for all archives |
| 105 | + (cd release && sha256sum * > SHA256SUMS.txt) |
| 106 | +
|
| 107 | + echo "Release artifacts:" |
| 108 | + ls -l release |
| 109 | +
|
| 110 | + - name: Create release and upload assets |
| 111 | + uses: softprops/action-gh-release@v2 |
| 112 | + with: |
| 113 | + tag_name: ${{ github.ref_name }} # e.g. v1.2.3 |
| 114 | + name: ${{ github.ref_name }} |
| 115 | + body: | |
| 116 | + Automated release for ${{ github.ref_name }}. |
| 117 | +
|
| 118 | + This release includes per-arch archives of static OpenSSH client binaries (both .tar.gz and .zip). |
| 119 | + A SHA256SUMS.txt is provided for verification. |
| 120 | + draft: false |
| 121 | + prerelease: false |
| 122 | + generate_release_notes: true |
| 123 | + files: | |
| 124 | + release/*.tar.gz |
| 125 | + release/*.zip |
| 126 | + release/SHA256SUMS.txt |
| 127 | + env: |
| 128 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments