Merge pull request #6 from Onlineberatung/CVE-2023-38545 #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Docker image | |
on: | |
push: | |
branches: | |
- "develop" | |
tags: | |
- "dockerImage.v.*" | |
- "v*" | |
jobs: | |
push_to_registry: | |
strategy: | |
matrix: | |
registry: ['docker.pkg.github.com', 'ghcr.io'] | |
name: Push Docker image to GitHub Packages | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get current time | |
id: time | |
uses: nanzm/[email protected] | |
with: | |
timeZone: 2 | |
format: "YYYYMMDD[_]HHmmss" | |
- name: Prepare environment variables | |
run: | | |
echo "DOCKER_REGISTRY=$(echo "${{ matrix.registry }}/${{ github.repository }}" | awk '{print tolower($0)}')" >> $GITHUB_ENV | |
echo "DOCKER_IMAGE=$(echo "${{ github.repository }}" | awk -F / '{print tolower($2)}')" >> $GITHUB_ENV | |
echo BRANCH=$(echo -n "${GITHUB_REF#refs/heads/}") >> $GITHUB_ENV | |
echo TIME_STAMP=$(echo -n "${{ steps.time.outputs.time }}") >> $GITHUB_ENV | |
shell: bash | |
- name: Set tag for develop image | |
if: endsWith(env.BRANCH, 'develop') == true | |
run: echo DOCKER_IMAGE_TAG=$(echo "develop_${{ env.TIME_STAMP }}") >> $GITHUB_ENV | |
shell: bash | |
- name: Set tag for default image | |
if: endsWith(env.BRANCH, 'develop') == false | |
run: echo DOCKER_IMAGE_TAG=$(echo "${GITHUB_REF/refs\/tags\//}") >> $GITHUB_ENV | |
shell: bash | |
- name: Push to GitHub Packages | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.GH_PACKAGE_RELEASE_USER }} | |
password: ${{ secrets.GH_PACKAGE_RELEASE_TOKEN }} | |
registry: ${{ env.DOCKER_REGISTRY }} | |
repository: ${{ env.DOCKER_IMAGE }} | |
tags: ${{ env.DOCKER_IMAGE_TAG}} |