Skip to content

CI: introduce a composite workflow for docker image handling #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
33 changes: 33 additions & 0 deletions .github/actions/push-container/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Push Container
description: Push a Container

inputs:
registry:
description: Server address of Docker registry.
required: true
username:
description: Username used to login.
required: true
password:
description: Password or PAT used to login.
required: true

image:
description: The name of the image to push.
required: true
tag:
description: The tag of the image to push.
required: true

runs:
using: "composite"
steps:
- uses: docker/login-action@v2
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.username }}
password: ${{ inputs.password }}

- shell: bash
run: |
docker push ${{ inputs.registry }}/${{ inputs.name }}:${{ inputs.tag }}
11 changes: 4 additions & 7 deletions .github/workflows/llvm-project-epoch-one.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@ jobs:
platforms: ${{ matrix.platforms }}
tags: ghcr.io/clangbuiltlinux/llvm-project:stage2-${{ matrix.arch }}

- name: Login to ghcr.io
- name: Push image to ghcr.io
uses: ./.github/actions/push-container
if: ${{ github.repository_owner == 'ClangBuiltLinux' && github.event_name != 'pull_request' && github.ref_name == 'main' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push image to ghcr.io
if: ${{ github.repository_owner == 'ClangBuiltLinux' && github.event_name != 'pull_request' && github.ref_name == 'main' }}
run: |
docker push ghcr.io/clangbuiltlinux/llvm-project:stage2-${{ matrix.arch }}
image: clangbuiltlinux/llvm-project
tag: stage2
11 changes: 4 additions & 7 deletions .github/workflows/llvm-project-epoch-three.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,12 @@ jobs:
platforms: ${{ matrix.platforms }}
tags: ghcr.io/clangbuiltlinux/llvm-project:stage3-${{ matrix.arch }}

- name: Login to ghcr.io
- name: Push image to ghcr.io
uses: ./.github/actions/push-container
if: ${{ github.repository_owner == 'ClangBuiltLinux' && github.event_name != 'pull_request' && github.ref_name == 'main' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push image to ghcr.io
if: ${{ github.repository_owner == 'ClangBuiltLinux' && github.event_name != 'pull_request' && github.ref_name == 'main' }}
run: |
docker push ghcr.io/clangbuiltlinux/llvm-project:stage3-${{ matrix.arch }}
image: clangbuiltlinux/llvm-project
tag: stage3
11 changes: 4 additions & 7 deletions .github/workflows/llvm-project-epoch-two.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,12 @@ jobs:
platforms: ${{ matrix.platforms }}
tags: ghcr.io/clangbuiltlinux/llvm-project:stage2-${{ matrix.arch }}

- name: Login to ghcr.io
- name: Push image to ghcr.io
uses: ./.github/actions/push-container
if: ${{ github.repository_owner == 'ClangBuiltLinux' && github.event_name != 'pull_request' && github.ref_name == 'main' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push image to ghcr.io
if: ${{ github.repository_owner == 'ClangBuiltLinux' && github.event_name != 'pull_request' && github.ref_name == 'main' }}
run: |
docker push ghcr.io/clangbuiltlinux/llvm-project:stage2-${{ matrix.arch }}
image: clangbuiltlinux/llvm-project
tag: stage2