|
66 | 66 | name: package Debian artifact |
67 | 67 | runs-on: ubuntu-latest |
68 | 68 | needs: kernel-4-15 |
| 69 | + outputs: |
| 70 | + version: ${{ steps.version.outputs.version }} |
69 | 71 | env: |
70 | 72 | KERNEL_RELEASE: 4.15.0-60-generic |
71 | 73 | KERNEL_ARCHITECTURE: i386 |
@@ -144,3 +146,73 @@ jobs: |
144 | 146 | dist-pcct/*.deb |
145 | 147 | dist-pcct/*.deb.sha256 |
146 | 148 | dist-pcct/install-usbdisplay-offline.sh |
| 149 | +
|
| 150 | + publish-tag: |
| 151 | + name: publish tagged Debian package |
| 152 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
| 153 | + runs-on: ubuntu-latest |
| 154 | + needs: debian-package |
| 155 | + permissions: |
| 156 | + contents: write |
| 157 | + packages: write |
| 158 | + env: |
| 159 | + OCI_PACKAGE: ghcr.io/iotsharp/usbdisplaystack-deb |
| 160 | + PACKAGE_VERSION: ${{ needs.debian-package.outputs.version }} |
| 161 | + steps: |
| 162 | + - name: Download Debian package |
| 163 | + uses: actions/download-artifact@v4 |
| 164 | + with: |
| 165 | + name: usbdisplay-stack-deb-${{ needs.debian-package.outputs.version }} |
| 166 | + path: dist-pcct |
| 167 | + |
| 168 | + - name: Publish GitHub Release assets |
| 169 | + shell: bash |
| 170 | + env: |
| 171 | + GH_TOKEN: ${{ github.token }} |
| 172 | + run: | |
| 173 | + set -eu |
| 174 | + shopt -s nullglob |
| 175 | + assets=( |
| 176 | + dist-pcct/*.deb |
| 177 | + dist-pcct/*.deb.sha256 |
| 178 | + dist-pcct/install-usbdisplay-offline.sh |
| 179 | + ) |
| 180 | + if [ "${#assets[@]}" -ne 3 ]; then |
| 181 | + printf 'Expected three release assets, found %s\n' "${#assets[@]}" >&2 |
| 182 | + exit 1 |
| 183 | + fi |
| 184 | + if ! gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then |
| 185 | + gh release create "$GITHUB_REF_NAME" \ |
| 186 | + --verify-tag \ |
| 187 | + --title "$GITHUB_REF_NAME" \ |
| 188 | + --generate-notes |
| 189 | + fi |
| 190 | + gh release upload "$GITHUB_REF_NAME" "${assets[@]}" --clobber |
| 191 | +
|
| 192 | + - name: Install ORAS |
| 193 | + uses: oras-project/setup-oras@v1 |
| 194 | + |
| 195 | + - name: Publish Debian package to GitHub Packages |
| 196 | + shell: bash |
| 197 | + env: |
| 198 | + GHCR_TOKEN: ${{ github.token }} |
| 199 | + run: | |
| 200 | + set -eu |
| 201 | + package=$(find dist-pcct -maxdepth 1 -type f -name '*.deb' -print -quit) |
| 202 | + checksum="${package}.sha256" |
| 203 | + installer=dist-pcct/install-usbdisplay-offline.sh |
| 204 | + test -f "$package" |
| 205 | + test -f "$checksum" |
| 206 | + test -f "$installer" |
| 207 | + printf '%s' "$GHCR_TOKEN" | oras login ghcr.io \ |
| 208 | + --username "$GITHUB_ACTOR" \ |
| 209 | + --password-stdin |
| 210 | + oras push "$OCI_PACKAGE:$GITHUB_REF_NAME" \ |
| 211 | + --artifact-type application/vnd.iotsharp.usbdisplaystack.debian.v1 \ |
| 212 | + --annotation "org.opencontainers.image.source=https://github.com/$GITHUB_REPOSITORY" \ |
| 213 | + --annotation "org.opencontainers.image.revision=$GITHUB_SHA" \ |
| 214 | + --annotation "org.opencontainers.image.version=$PACKAGE_VERSION" \ |
| 215 | + --annotation "org.opencontainers.image.title=USBDisplayStack Debian package" \ |
| 216 | + "$package:application/vnd.debian.binary-package" \ |
| 217 | + "$checksum:text/plain" \ |
| 218 | + "$installer:application/vnd.iotsharp.usbdisplaystack.installer.v1+shell" |
0 commit comments