Create new release #40
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: Create new release | |
on: | |
workflow_dispatch: | |
inputs: | |
version_tag: | |
description: '1.2.3' | |
required: true | |
jobs: | |
build: | |
name: Release | |
runs-on: ubuntu-22.04 | |
env: | |
centos_repo_main: dodopizza/centos | |
centos_repo_dev: dodopizza/centos-dev | |
centos_repo_ghcr_main: ghcr.io/dodopizza/centos | |
centos_repo_ghcr_dev: ghcr.io/dodopizza/centos-dev | |
steps: | |
- name: Login to hub.docker | |
run: | | |
echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login --username=${{ secrets.DOCKERHUB_USERNAME }} --password-stdin | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Retag dev image and push to prepare release draft | |
run: | | |
branch_short_sha=$( echo ${{ github.ref }} | sha1sum | cut -c1-6 ) | |
docker pull ${centos_repo_dev}:${branch_short_sha} | |
for image_tag in \ | |
"${centos_repo_main}:$( echo ${{ github.event.inputs.version_tag }} | cut -d . -f 1 )" \ | |
"${centos_repo_main}:$( echo ${{ github.event.inputs.version_tag }} | cut -d . -f -2 )" \ | |
"${centos_repo_main}:$( echo ${{ github.event.inputs.version_tag }} )" | |
do | |
docker tag ${centos_repo_dev}:${branch_short_sha} ${image_tag} | |
docker push ${image_tag} | |
done | |
docker pull ${centos_repo_ghcr_dev}:${branch_short_sha} | |
for image_tag in \ | |
"${centos_repo_ghcr_main}:$( echo ${{ github.event.inputs.version_tag }} | cut -d . -f 1 )" \ | |
"${centos_repo_ghcr_main}:$( echo ${{ github.event.inputs.version_tag }} | cut -d . -f -2 )" \ | |
"${centos_repo_ghcr_main}:$( echo ${{ github.event.inputs.version_tag }} )" | |
do | |
docker tag ${centos_repo_ghcr_dev}:${branch_short_sha} ${image_tag} | |
docker push ${image_tag} | |
done | |
- name: Get apps version and draft release message | |
id: image_app_versions | |
run: | | |
function set-multiline-output(){ | |
local output_key=${1} | |
local output_val="${2}" | |
echo "${output_val}" | |
output_val="${output_val//'%'/'%25'}" | |
output_val="${output_val//$'\n'/'%0A'}" | |
output_val="${output_val//$'\r'/'%0D'}" | |
echo "${output_key}=${output_val}" >> $GITHUB_OUTPUT | |
} | |
branch_short_sha=$( echo ${{ github.ref }} | sha1sum | cut -c1-6 ) | |
apps_version_info=$( docker run --rm ${centos_repo_dev}:${branch_short_sha} bash -c '/version-info.sh' ) | |
set-multiline-output apps_version_info \ | |
"Image Docker Hub: ${centos_repo_main}:${{ github.event.inputs.version_tag }} | |
Image GitHub Container Registry: ${centos_repo_ghcr_main}:${{ github.event.inputs.version_tag }} | |
**Utils preinstalled:** | |
${apps_version_info}" | |
- name: Create draft release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.version_tag }} | |
release_name: ${{ env.centos_repo_main }}:${{ github.event.inputs.version_tag }} | |
draft: false | |
prerelease: false | |
body: ${{ steps.image_app_versions.outputs.apps_version_info }} |