Skip to content

v2.4.1 - Vulnerable dependencies #18

v2.4.1 - Vulnerable dependencies

v2.4.1 - Vulnerable dependencies #18

Workflow file for this run

---
name: Docker push
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
required: true
type: string
env:
BASE_TAG: lkurzyniec/netcore-boilerplate
jobs:
build-and-test:
uses: ./.github/workflows/docker-build.yml
push:
name: Push to registries
runs-on: ubuntu-latest
needs: build-and-test
environment: docker
concurrency: docker-push
permissions:
packages: write
if: |
(github.event_name == 'release' &&
github.event.action == 'published' &&
github.ref_type == 'tag')
||
(github.event_name == 'workflow_dispatch' &&
contains(inputs.version, 'preview'))
steps:
- name: Status check
run: |
echo "Checking HTTP status..."
if [ "${{ needs.build-and-test.outputs.test-http-code }}" = "200" ]; then
echo "All is fine, let's push and publish a new version!"
else
echo "Status is invalid! Abort..."
exit 1
fi
- name: Grab a version
run: |
date=$(date --rfc-3339=date)
echo "DATE=${date}" >> $GITHUB_ENV
version="${{ github.event_name == 'release' && github.ref || format('{0}.', inputs.version) }}"
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
version="${version}${date}"
fi
version="${version/refs\/tags\/v/}"
echo "Version: ${version}"
echo "### Version ${version} published! :rocket:" >> $GITHUB_STEP_SUMMARY
echo "VERSION=${version}" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
labels: |
org.opencontainers.image.source=${{ github.repositoryUrl }}
org.opencontainers.image.url=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.version=${{ env.VERSION }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ env.DATE }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
build-args: |
VERSION=${{ env.VERSION }}
SHA=${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}
tags: |
${{ env.BASE_TAG }}:${{ env.VERSION }}
${{ env.BASE_TAG }}:latest
ghcr.io/${{ env.BASE_TAG }}:${{ env.VERSION }}
ghcr.io/${{ env.BASE_TAG }}:latest