-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (42 loc) · 1.77 KB
/
build-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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}"