mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-08-27 12:30:13 +03:00
62 lines
1.8 KiB
YAML
62 lines
1.8 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
tags:
|
|
- v2.*
|
|
- v3.*
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
DOCKERHUB_ORG: ${{ vars.DOCKERHUB_ORG || 'gns3' }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Check for stable release
|
|
id: ver
|
|
run: |
|
|
TAG="${GITHUB_REF_NAME#v}"
|
|
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
|
if echo "$TAG" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
|
|
echo "stable=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "stable=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Set up Docker Buildx
|
|
if: steps.ver.outputs.stable == 'true'
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to GitHub Container Registry
|
|
if: steps.ver.outputs.stable == 'true'
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Login to Docker Hub
|
|
if: steps.ver.outputs.stable == 'true'
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: docker.io
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Build and push
|
|
if: steps.ver.outputs.stable == 'true'
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
${{ env.DOCKERHUB_ORG }}/${{ github.event.repository.name }}:${{ steps.ver.outputs.tag }}
|
|
${{ env.DOCKERHUB_ORG }}/${{ github.event.repository.name }}:latest
|
|
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.ver.outputs.tag }}
|
|
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest
|