Skip to content

alogned with latest vers #42

alogned with latest vers

alogned with latest vers #42

name: Build SSH Proxy Image
on:
push:
branches:
- main
- v0.11
tags:
- "v*"
jobs:
build-ssh-proxy:
runs-on: k8shell-runner
env:
GO111MODULE: on
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Git for private modules
run: |
git config --global url."https://${{ secrets.GH_PAT_TOKEN }}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.24.5'
- name: Get version and commit ID
run: |
VERSION=$(git describe --tags --match '*' | sed 's/-g.*//')
COMMIT_ID=$(git rev-parse --short HEAD)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "COMMIT_ID=$COMMIT_ID" >> $GITHUB_ENV
- name: Vendor Go modules
run: |
go mod vendor
mkdir -p docker/ssh-proxy/files
cp -r vendor docker/ssh-proxy/files/
- name: Copy sources to docker context
run: |
cp go.mod go.sum main.go -t docker/ssh-proxy/files/
cp -r internal docker/ssh-proxy/files/
echo -n "k8shell-base/ssh-proxy:$VERSION" > docker/ssh-proxy/BUILD
- name: Load REPO_NAME from docker/ssh-proxy/BUILD
run: echo "REPO_NAME=$(cat docker/ssh-proxy/BUILD)" >> $GITHUB_ENV
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY }}
username: ${{ secrets.HARBOR_USER }}
password: ${{ secrets.HARBOR_PASSWORD }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: docker/ssh-proxy
tags: ${{ secrets.REGISTRY }}/${{ env.REPO_NAME }}
push: true
build-args: |
VERSION=${{ env.VERSION }}
COMMIT_ID=${{ env.COMMIT_ID }}