-
Notifications
You must be signed in to change notification settings - Fork 16
144 lines (139 loc) · 5.73 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: dockerhub_sshnpd
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
docker_arm64:
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-24.04-arm
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@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
- 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@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/arm64,linux/arm/v7
push: true
provenance: false
tags: |
atsigncompany/${{ matrix.name }}:${{ env.VERSION }}
atsigncompany/${{ matrix.name }}:release-${{ env.VERSION }}
docker_amd64:
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@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
- 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@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64
push: true
provenance: false
tags: |
atsigncompany/${{ matrix.name }}:amd64-${{ env.VERSION }}
atsigncompany/${{ matrix.name }}:amd64-release-${{ env.VERSION }}
docker_combine:
needs: [docker_amd64, docker_arm64]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: sshnpd
- name: activate_sshnpd
- name: sshnpd-slim
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
- 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: Combine build images
id: docker_manifest_build
run: |
docker buildx imagetools create \
-t atsigncompany/${{ matrix.name }}:${{ env.VERSION }} \
--append atsigncompany/${{ matrix.name }}:amd64-${{ env.VERSION }}
docker buildx imagetools create \
-t atsigncompany/${{ matrix.name }}:release-${{ env.VERSION }} \
--append atsigncompany/${{ matrix.name }}:amd64-release-${{ env.VERSION }}
# Promote to latest so long as this isn't a pre-release
- name: Update latest tag
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