-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (41 loc) · 1.83 KB
/
Copy pathdocker-publish.yml
File metadata and controls
48 lines (41 loc) · 1.83 KB
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
46
47
48
name: Publish Docker Image
on:
workflow_dispatch: # Allow manual triggering of the workflow
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
asterisk_version: [master, 23, 22, 21]
base_version: [9-minimal]
enable_chan_sip: [false, true]
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Get Asterisk commit hash
id: commit
run: |
# Clone the same Asterisk repository as in Dockerfile to get exact commit
git clone --depth 1 --single-branch --branch ${{ matrix.asterisk_version }} https://github.com/asterisk/asterisk.git temp-asterisk
cd temp-asterisk
COMMIT_HASH=$(git rev-parse HEAD)
echo "hash=${COMMIT_HASH:0:7}" >> $GITHUB_OUTPUT
echo "Asterisk commit hash: ${COMMIT_HASH:0:7}"
cd ..
rm -rf temp-asterisk
- name: Build and push with commit tag
uses: docker/build-push-action@v6
with:
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/asterisk-rockylinux:${{ matrix.asterisk_version }}-${{ matrix.base_version }}${{ matrix.enable_chan_sip == true && '-chansip' || '' }}-${{ steps.commit.outputs.hash }}
${{ secrets.DOCKER_USERNAME }}/asterisk-rockylinux:${{ matrix.asterisk_version }}-${{ matrix.base_version }}${{ matrix.enable_chan_sip == true && '-chansip' || '' }}
build-args: |
ASTERISK_VERSION=${{ matrix.asterisk_version }}
BASE_VERSION=${{ matrix.base_version }}
ENABLE_CHAN_SIP=${{ matrix.enable_chan_sip == true && 'true' || 'false' }}