Skip to content

add branch support

add branch support #6

name: Build and Release Docker Image
on:
push:
branches:
- main
- fortress
- harmonic
jobs:
build_and_push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repository
uses: actions/checkout@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
run: |
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/[^a-zA-Z0-9._-]/-/g')
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/gazebo:${BRANCH_NAME}
docker build -t $IMAGE_NAME .
docker push $IMAGE_NAME