github: add docker push readme action #29
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: Push OpenSIPS Control Panel Image in Docker Hub | |
on: | |
push: | |
repository_dispatch: | |
types: [OpenSIPS CP trigger] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Log in to Docker Hub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Determine tag | |
run: | | |
if [ "${{ github.event_name }}" == "repository_dispatch" ]; then | |
echo "BRANCH=${{ github.event.client_payload.branch && github.event.client_payload.branch || 'master' }}" >> $GITHUB_ENV | |
echo "DOCKER_TAG=${{ github.event.client_payload.docker_tag }}" >> $GITHUB_ENV | |
else | |
echo "DOCKER_TAG=latest" >> $GITHUB_ENV | |
echo "BRANCH=master" >> $GITHUB_ENV | |
fi | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
build-args: | | |
OPENSIPS_CP_VERSION=${{ env.BRANCH }} | |
push: true | |
tags: opensips/opensips-cp:${{ env.DOCKER_TAG }} |