Skip to content

Bump the aspnet-core group in /server with 1 update #49

Bump the aspnet-core group in /server with 1 update

Bump the aspnet-core group in /server with 1 update #49

Workflow file for this run

name: Deploy Docker Image
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
branches:
- main
paths:
- '.github/workflows/deploy.yml'
- 'bin/**'
- 'server/**'
- 'Dockerfile'
- '.dockerignore'
jobs:
determine-deployment-config:
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.determine-environment.outputs.environment }}
steps:
- name: Determine environment
id: determine-environment
env:
REF_TYPE: ${{ github.ref_type }}
run: |
if [ "${REF_TYPE}" == 'tag' ]; then
echo 'environment=production' >> "${GITHUB_OUTPUT}"
else
echo 'environment=development' >> "${GITHUB_OUTPUT}"
fi
run-deployment:
needs: determine-deployment-config
environment: ${{ needs.determine-deployment-config.outputs.environment }}
runs-on: ubuntu-latest
steps:
- name: Get image parameters
id: image-parameters
env:
IS_RELEASE: ${{ github.ref_type == 'tag' }}
RELEASE_TAG: ${{ github.ref_name }}
SHA: ${{ github.sha }}
run: |
VERSION_TAG=''
LATEST_TAG=''
if [ "${IS_RELEASE}" == 'true' ]; then
VERSION_TAG="${RELEASE_TAG}"
LATEST_TAG='stable'
else
VERSION_TAG="rev-$(echo "${SHA}" | cut -c1-7)"
LATEST_TAG='latest'
fi
echo "latest-tag=${LATEST_TAG}" >> "${GITHUB_OUTPUT}"
echo "version-tag=${VERSION_TAG}" >> "${GITHUB_OUTPUT}"
echo "version-arg=${VERSION_TAG}" >> "${GITHUB_OUTPUT}"
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ vars.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/build-push-action@v5
with:
pull: true
push: true
platforms: linux/amd64
build-args: |
VERSION=${{ steps.image-parameters.outputs.version-arg }}
tags: |
${{ vars.DOCKER_REGISTRY }}/${{ vars.DOCKER_IMAGE }}:${{ steps.image-parameters.outputs.version-tag }}
${{ vars.DOCKER_REGISTRY }}/${{ vars.DOCKER_IMAGE }}:${{ steps.image-parameters.outputs.latest-tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: fjogeleit/http-request-action@v1
with:
method: POST
url: "${{ secrets.DEPLOYER_URL }}/api/v1/deploy"
bearerToken: ${{ secrets.DEPLOYER_TOKEN }}
timeout: 0
data: |
{
"image": "${{ vars.DOCKER_IMAGE }}",
"tags": [ "${{ steps.image-parameters.outputs.version-tag }}", "${{ steps.image-parameters.outputs.latest-tag }}" ]
}