56 lines
1.4 KiB
YAML
56 lines
1.4 KiB
YAML
name: Docker Image CI
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
jobs:
|
|
|
|
docker-releases:
|
|
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/') && (github.ref_name == 'main' || github.ref_name == 'prod')
|
|
|
|
steps:
|
|
- name: Get release version
|
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
|
|
|
- name: downcase username
|
|
run: echo "lower_actor=${GITHUB_ACTOR,,}" >> $GITHUB_ENV
|
|
|
|
- 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: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Determine latest tag
|
|
run: |
|
|
if [[ "${GITHUB_REF_NAME}" == "main" ]]; then
|
|
echo "LATEST_TAG=latest" >> $GITHUB_ENV
|
|
elif [[ "${GITHUB_REF_NAME}" == "prod" ]]; then
|
|
echo "LATEST_TAG=latest-prod" >> $GITHUB_ENV
|
|
else
|
|
echo "LATEST_TAG=" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Build and push Docker images
|
|
uses: docker/build-push-action@v6.9.0
|
|
with:
|
|
context: ./
|
|
push: true
|
|
tags: |
|
|
ghcr.io/${{ env.lower_actor }}/aperisolve:${{ env.RELEASE_VERSION }}
|
|
ghcr.io/${{ env.lower_actor }}/aperisolve:${{ env.LATEST_TAG }}
|