mirror of
https://github.com/GyulyVGC/sniffnet.git
synced 2026-08-04 14:51:37 +00:00
52 lines
1.6 KiB
YAML
52 lines
1.6 KiB
YAML
name: Docker
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
docker:
|
|
name: Docker Build
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Extract version from Cargo.toml
|
|
id: cargo-version
|
|
run: |
|
|
VERSION=v$(grep -m1 "^version" Cargo.toml | cut -d'"' -f2)
|
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Check there is no existing image with the same version
|
|
run: |
|
|
if docker manifest inspect ghcr.io/gyulyvgc/sniffnet:${{ env.VERSION }}; then
|
|
echo "Image with version ${{ env.VERSION }} already exists"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@abd2ef45e78c5afb21d64d4ca52ee8550d9572c7 # v4.5.1
|
|
with:
|
|
registry: ghcr.io
|
|
username: GyulyVGC
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
push: true
|
|
tags: |
|
|
ghcr.io/gyulyvgc/sniffnet:latest
|
|
ghcr.io/gyulyvgc/sniffnet:${{ env.VERSION }}
|