Publish Docker Image #61
This file contains hidden or 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: 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' }} |