-
Notifications
You must be signed in to change notification settings - Fork 2
43 lines (40 loc) · 1.34 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
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: install-podman
run: |
# Install podman
sudo apt update
sudo apt-get -y install --install-recommends podman
- 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 -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}"