mirror of
https://github.com/wireadmin/wireadmin
synced 2025-01-23 20:36:58 +00:00
88 lines
2.4 KiB
YAML
88 lines
2.4 KiB
YAML
name: Build Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "master"
|
|
tags:
|
|
- "v*.*.*"
|
|
|
|
jobs:
|
|
ghcr-build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
env:
|
|
IMAGE_NAME: shahradelahi/wireadmin
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.PRIVATE_TOKEN }}
|
|
|
|
# If it was a release tag, use the tag as the image tag,
|
|
# and otherwise image tag is the commit SHA
|
|
- name: Set image tag
|
|
run: |
|
|
if [[ $GITHUB_REF == refs/tags/v* ]]; then
|
|
echo "Labeling image with TAG: ${GITHUB_REF#refs/tags/v}"
|
|
echo "IMAGE_TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
|
echo "RELEASE_TAG=,ghcr.io/${IMAGE_NAME}:latest" >> $GITHUB_ENV
|
|
else
|
|
echo "Labeling image with commit SHA: ${GITHUB_SHA}"
|
|
echo "IMAGE_TAG=${GITHUB_SHA}" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Push to GitHub Container Registry
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
tags: ghcr.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}${{ env.RELEASE_TAG }}
|
|
|
|
|
|
docker-build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
env:
|
|
IMAGE_NAME: litehex/wireadmin
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: docker.io
|
|
username: litehex
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Set image tag
|
|
run: |
|
|
if [[ $GITHUB_REF == refs/tags/v* ]]; then
|
|
echo "Labeling image with TAG: ${GITHUB_REF#refs/tags/v}"
|
|
echo "IMAGE_TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
|
echo "RELEASE_TAG=,docker.io/${IMAGE_NAME}:latest" >> $GITHUB_ENV
|
|
else
|
|
echo "Labeling image with commit SHA: ${GITHUB_SHA}"
|
|
echo "IMAGE_TAG=${GITHUB_SHA}" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Push to DockerHub
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
tags: docker.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}${{ env.RELEASE_TAG }} |