Skip to content

docker: fix images

docker: fix images #29

Workflow file for this run

name: Create release
on:
push:
tags: [ "v*" ]
workflow_dispatch:
permissions:
contents: write
packages: read
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm]
version: ["ubuntu:noble", "ubuntu:jammy", "ubuntu:focal", "debian:trixie", "debian:bookworm", "debian:bullseye"]
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- name: Set image tag
id: vars
run: |
CODENAME=$(echo "${{ matrix.version }}" | cut -d':' -f2)
ARCH="amd64"
[[ "${{ matrix.os }}" == *arm* ]] && ARCH="arm64"
echo "arch=${ARCH}" >> $GITHUB_OUTPUT
echo "codename=${CODENAME}" >> $GITHUB_OUTPUT
echo "image=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:deps-${CODENAME}-${ARCH}" >> $GITHUB_OUTPUT
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull prebuilt dependency image
run: docker pull ${{ steps.vars.outputs.image }}
- name: Compile ${{ matrix.version }} on ${{ matrix.os }}
run: |
./pullsrc.sh
docker run --rm -v ${{ github.workspace }}:/work -w /work ${{ steps.vars.outputs.image }} bash -c "./compile.sh"
- name: Install test with ${{ matrix.version }}
run: |
docker run --rm -v ${{ github.workspace }}:/work -w /work library/${{ matrix.version }} bash -c "apt update && apt install -y --no-install-recommends ./output/*.deb && ssh -V"
- name: Pack .deb files into tar.gz
id: pack
run: |
TAG_NAME="${{ github.ref_name }}"
CODENAME=$(echo "${{ matrix.version }}" | cut -d':' -f2)
ARCH="amd64"
[[ "${{ matrix.os }}" == *arm* ]] && ARCH="arm64"
cd ${{ github.workspace }}/output
tar -cvzf ../openssh-${TAG_NAME}-${CODENAME}-${ARCH}.tar.gz *.deb
SAFE_VERSION=$(echo "${{ matrix.version }}" | sed 's/:/-/g')
echo "artifact_name=${SAFE_VERSION}-${ARCH}" >> $GITHUB_OUTPUT
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: upload-${{ steps.pack.outputs.artifact_name }}
path: ${{ github.workspace }}/openssh-*.tar.gz
create_release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- name: Download all archives
uses: actions/download-artifact@v7
with:
path: ./output
merge-multiple: true
- name: Get tag message
run: |
echo -e "> Automated release created by GitHub Actions.\n" > ${{ github.workspace }}/RELEASE.md
GITHUB_REF=${{ github.ref }}
TAG_NAME="${GITHUB_REF#refs/tags/}"
git tag -l --format='%(contents)' "${TAG_NAME}" | tee -a ${{ github.workspace }}/RELEASE.md
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: "${{ github.workspace }}/output/*.tar.gz"
bodyFile: ${{ github.workspace }}/RELEASE.md
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true