-
Notifications
You must be signed in to change notification settings - Fork 15
68 lines (65 loc) · 2.66 KB
/
dockerhub_sshnpd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- 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@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.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@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.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