Skip to content

Merge pull request #994 from atsign-foundation/cpswan-fix-branch-prefix #94

Merge pull request #994 from atsign-foundation/cpswan-fix-branch-prefix

Merge pull request #994 from atsign-foundation/cpswan-fix-branch-prefix #94

name: dockerhub_sshnpd
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
docker:
strategy:
matrix:
include:
- name: sshnpd
dockerfile: ./packages/dart/sshnoports/tools/Dockerfile
- name: activate_sshnpd
dockerfile: ./packages/dart/sshnoports/tools/Dockerfile.activate
- name: sshnpd-slim
dockerfile: ./packages/dart/sshnoports/tools/Dockerfile.sshnpd-slim
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Ensure pubspec.yaml matches git ref (if current git ref is a version tag)
shell: bash
if: startsWith(github.ref, 'refs/tags/v')
working-directory: ./packages/dart/sshnoports
run: |
REF=${{ github.ref }}
VER=${REF:11}
sed -i "0,/version:/{s/version: \(.*\)/version: "${VER}"/}" pubspec.yaml
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: Login to Docker Hub
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Extract version for docker tag
- name: Get version
run: echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
provenance: false
tags: |
atsigncompany/${{ matrix.name }}:${{ env.VERSION }}
atsigncompany/${{ matrix.name }}:release-${{ env.VERSION }}
# Promote to latest so long as this isn't a pre-release
- name: Tag latest
run: |
RELEASE_JSON=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ env.VERSION }}")
PRERELEASE=$(echo "$RELEASE_JSON" | jq -r '.prerelease')
if [ $PRERELEASE == 'false' ]; then
docker buildx imagetools create -t \
atsigncompany/${{ matrix.name }}:latest \
atsigncompany/${{ matrix.name }}:release-${{ env.VERSION }}
fi