mirror of
https://github.com/wireadmin/wireadmin
synced 2025-01-23 20:36:58 +00:00
47 lines
1.2 KiB
YAML
47 lines
1.2 KiB
YAML
name: Build Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "master"
|
|
tags:
|
|
- "v*.*.*"
|
|
|
|
env:
|
|
IMAGE_NAME: shahradelahi/wireadmin
|
|
# By default, image tag is the commit SHA
|
|
IMAGE_TAG: ${{ github.sha }}
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
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
|
|
- name: Set image tag
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
run: |
|
|
echo "IMAGE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
|
echo "IMAGE_TAG=${IMAGE_TAG//./-}" >> $GITHUB_ENV
|
|
echo "RELEASE_TAG=,ghcr.io/${IMAGE_NAME}:latest" >> $GITHUB_ENV
|
|
|
|
- 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 }}
|