Skip to content

Merge pull request #1538 from atsign-foundation/update-policy-admin-a… #123

Merge pull request #1538 from atsign-foundation/update-policy-admin-a…

Merge pull request #1538 from atsign-foundation/update-policy-admin-a… #123

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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- 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@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.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@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.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