72 lines
1.9 KiB
YAML
72 lines
1.9 KiB
YAML
name: Build and Push Docker image (ext)
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- ext
|
|
|
|
env:
|
|
REGISTRY: git.4nkweb.com
|
|
IMAGE_NAMESPACE: 4nk
|
|
IMAGE_NAME: ihm_client
|
|
DOCKER_TAG: ext
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ secrets.USER }}
|
|
password: ${{ secrets.TOKEN }}
|
|
|
|
- name: Setup SSH agent for git clone
|
|
uses: webfactory/ssh-agent@v0.9.0
|
|
with:
|
|
ssh-private-key: |
|
|
${{ secrets.SSH_PRIVATE_KEY }}
|
|
|
|
- name: Build WebAssembly
|
|
run: |
|
|
set -euo pipefail
|
|
# Install Rust and wasm-pack
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
source ~/.cargo/env
|
|
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
|
|
# Build the WebAssembly package
|
|
npm run build_wasm
|
|
|
|
- name: Extract docker tag from commit message (optional)
|
|
id: tag
|
|
run: |
|
|
set -euo pipefail
|
|
MSG=$(git log -1 --pretty=%B | tr -d '\r')
|
|
if echo "$MSG" | grep -q "ci: docker_tag="; then
|
|
T=$(echo "$MSG" | sed -nE 's/.*ci: docker_tag=([^ ]+).*/\1/p' | tr -d '\n')
|
|
if [ -n "$T" ]; then
|
|
echo "tag=$T" >> $GITHUB_OUTPUT
|
|
fi
|
|
fi
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
platforms: linux/amd64
|
|
tags: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag || env.DOCKER_TAG }}
|
|
ssh: default
|