buildall-bin-from-obs push script #186
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
# This script builds runtime images by installing packages required by indimail, indimail-mta | |
# from open build service. This can be used only for distributions for which obs can be used | |
# to build binary packages | |
name: buildall-bin-from-obs push script | |
on: | |
workflow_dispatch: | |
# Inputs the workflow accepts. | |
inputs: | |
distro_list: | |
# Friendly description to be shown in the UI instead of 'name' | |
Distro List: 'distro list' | |
# Input has to be provided for the workflow to run | |
required: false | |
jobs: | |
build_and_push: | |
name: build and push container image | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v2 | |
- name: login | |
run: | | |
echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io --username "${{ github.repository_owner }}" --password-stdin | |
echo "${{ secrets.DOCKER_PAT }}" | docker login docker.io --username cprogrammer --password-stdin | |
- name: build | |
run: | | |
set +e | |
echo "Input=${{ github.event.inputs.distro_list }}" | |
if [ -z "${{ github.event.inputs.distro_list }}" ] ; then | |
package_list="indimail indimail-mta" | |
distros="almalinux8 oracle8 rockylinux8 almalinux9 oracle9 rockylinux9" | |
distros="$distros debian10 debian11 debian12 bionic focal jammy lunar" | |
distros="$distros fc37 fc38 leap15.5 tumbleweed" | |
else | |
echo "${{ github.event.inputs.distro_list }}" | grep ":" > /dev/null | |
if [ $? -eq 0 ] ; then | |
package_list=$(echo "${{ github.event.inputs.distro_list }}" | cut -d: -f2) | |
distros="$(echo "${{ github.event.inputs.distro_list }}" | cut -d: -f1)" | |
else | |
package_list="indimail indimail-mta" | |
distros="${{ github.event.inputs.distro_list }}" | |
fi | |
fi | |
flag="" | |
for i in $distros | |
do | |
for j in indimail indimail-mta | |
do | |
echo "Using $j/$i/Dockerfile for build" | |
cp $j/$i/Dockerfile . | |
docker build --tag "ghcr.io/${{ github.repository_owner }}/$j:$i" . | |
if [ $? -eq 0 ] ; then | |
echo "docker push ghcr.io/${{ github.repository_owner }}/$j:$i" | |
docker push "ghcr.io/${{ github.repository_owner }}/$j:$i" | |
docker image tag "ghcr.io/${{ github.repository_owner }}/$j:$i" docker.io/cprogrammer/$j:$i | |
echo "docker push docker.io/cprogrammer/$j:$i" | |
docker push docker.io/cprogrammer/$j:$i | |
else | |
flag="$flag $j:$i" | |
fi | |
/bin/rm -f Dockerfile | |
done | |
done | |
if [ -n "$flag" ] ; then | |
echo "docker build failed for $flag" | |
exit 1 | |
fi |