gpanel #2
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: Publish Docker image | |
on: | |
push: | |
branches: | |
- master | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
push_to_registry: | |
runs-on: ubuntu-latest | |
steps: | |
- name: get_image_name | |
run: | | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "master" ] && VERSION=latest | |
repository=${{ github.repository }} | |
IMAGE_NAME=${{ github.actor }}/${repository##*/}:$VERSION | |
echo IMAGE_NAME=$IMAGE_NAME | |
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push to Docker Hub | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: ${{ env.IMAGE_NAME }} | |
- name: Push gpanel to Docker Hub | |
run: | | |
docker build -f Dockerfile.gpanel -t ${{ env.IMAGE_NAME }}:gpanel . | |
docker push ${{ env.IMAGE_NAME }}:gpanel |