Clean code #685
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: "Build and publish image" | |
on: | |
workflow_dispatch: | |
push: | |
permissions: | |
packages: write | |
jobs: | |
publish_images: | |
name: 'Build and publish image' | |
runs-on: ubuntu-latest | |
env: | |
REPOBASE: ghcr.io/${{ github.repository_owner }} | |
IMAGETAG: ${{ github.ref_name }} | |
steps: | |
- uses: actions/checkout@v2 | |
- id: update-podman | |
run: | | |
# Update podman | |
echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04/ /' | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list | |
curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_22.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null | |
sudo apt update | |
sudo apt install podman -y | |
- id: build | |
run: | | |
# Build the module image | |
REPOBASE=${REPOBASE,,} | |
IMAGENAME=${REPOBASE}/nethvoice-cti | |
IMAGETAG=${IMAGETAG:-latest} | |
if [[ "${IMAGETAG}" == "main" || "${IMAGETAG}" == "master" ]]; then | |
IMAGETAG="latest" | |
fi | |
echo "REPOBASE=$REPOBASE" >> $GITHUB_ENV | |
echo "IMAGETAG=$IMAGETAG" >> $GITHUB_ENV | |
echo "IMAGENAME=$IMAGENAME" >> $GITHUB_ENV | |
podman build --env ICONS_TOKEN="${{ secrets.ICONS_TOKEN }}" -t ${IMAGENAME}:${IMAGETAG} . | |
- id: publish | |
run: | | |
# Publish the branch | |
trap 'buildah logout ghcr.io' EXIT | |
buildah login -u ${{ github.actor }} --password-stdin ghcr.io <<<"${{ secrets.GITHUB_TOKEN }}" | |
buildah push ${IMAGENAME}:${IMAGETAG} docker://${IMAGENAME}:${IMAGETAG} | |
echo "::notice title=Image URL::${IMAGENAME}:${IMAGETAG}" |