Skip to content

Commit

Permalink
add gh action to create docker image with a specified branch. Branch …
Browse files Browse the repository at this point in the history
…name will be used as image's tag name. (#1133)

Co-authored-by: neodiX <[email protected]>
  • Loading branch information
neodix42 and neodiX authored Aug 28, 2024
1 parent 48d94d5 commit 97c57c3
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/docker-ubuntu-branch-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Docker Ubuntu 22.04 branch image

on:
workflow_dispatch:
push:
branches-ignore:
- master

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push:
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get tag as branch name
id: tag
run: |
echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
push: true
context: ./
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.TAG }}

2 comments on commit 97c57c3

@DeepNiv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Alibetvay
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.github/workflows/docker-ubuntu-branch-image.yml

Please sign in to comment.