Docker Action Image Build and Push: #1
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: manual-image-build | |
run-name: "Docker Action Image Build and Push: ${{ github.event.head_commit.message }}" | |
on: | |
workflow_dispatch: | |
jobs: | |
build-image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v4 | |
- name: Set outputs | |
id: vars | |
run: | | |
echo "tag_name=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT | |
if [[ $GITHUB_REF == refs/tags/v* ]]; then | |
echo "tag_name=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT | |
fi | |
echo "VERSION=$(git describe --tags)" >> $GITHUB_ENV | |
echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
echo "GIT_DESCRIPTION=$(git log -1 --pretty=%B | head -n 1)" >> $GITHUB_ENV | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ghcr.io/easy-up/portage:${{ steps.vars.outputs.tag_name }} | |
build-args: "VERSION=${{ env.VERSION }},GIT_COMMIT=${{ env.GIT_COMMIT }},GIT_DESCRIPTION=${{ env.GIT_DESCRIPTION }}" | |
- name: Build and push podman target | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ghcr.io/easy-up/portage:podman-${{ steps.vars.outputs.tag_name }} | |
build-args: "VERSION=${{ env.VERSION }},GIT_COMMIT=${{ env.GIT_COMMIT }},GIT_DESCRIPTION=${{ env.GIT_DESCRIPTION }}" | |
target: portage-podman | |
- name: job summary | |
shell: bash | |
run: | | |
echo "## Docker Action Image Build and Push Summary" >> $GITHUB_STEP_SUMMARY | |
echo ":white_check_mark: Docker Action Image Build and Push" >> $GITHUB_STEP_SUMMARY | |
echo ":white_check_mark: Image (Docker CLI): ghcr.io/easy-up/portage:${{ steps.vars.outputs.tag_name }}" >> $GITHUB_STEP_SUMMARY | |
echo ":white_check_mark: Image (Podman CLI): ghcr.io/easy-up/portage:podman-${{ steps.vars.outputs.tag_name }}" >> $GITHUB_STEP_SUMMARY |