Skip to content
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

Split jobs for each container files #49

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,60 @@ on:
workflow_dispatch:

jobs:
build_and_push:
get-meta:
runs-on: ubuntu-22.04
timeout-minutes: 30
timeout-minutes: 5
outputs:
started_at: ${{ steps.timestamp.outputs.started_at }}
steps:
- name: Get started timestamp
id: get-meta
id: timestamp
run: |
# Do not use ":" delimiter as iso-8601/rfc-3339, it cannot be used in container tag
echo "started_at=$(date --utc '+%Y%m%d-%H%M%S-%Z')" >> "$GITHUB_OUTPUT"
ubuntu-nix-sudoer:
needs: [get-meta]
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 #v2.13
with:
image: ubuntu-nix-sudoer
tags: latest ${{ github.sha }} ${{ steps.get-meta.outputs.started_at }}
tags: latest ${{ github.sha }} ${{ needs.get-meta.outputs.started_at }}
containerfiles: |
./images/ubuntu-nix-sudoer/Containerfile
build-args: |
username=user
oci: true
- name: Push To ghcr.io
id: push-to-ghcr
if: ${{ github.event_name != 'pull_request' }}
uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c #v2.8
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Log outputs
if: ${{ github.event_name != 'pull_request' }}
run: echo "${{ toJSON(steps.push-to-ghcr.outputs) }}"
ubuntu-nix-systemd:
needs: [get-meta]
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 #v2.13
with:
image: ubuntu-nix-systemd
tags: latest ${{ github.sha }} ${{ needs.get-meta.outputs.started_at }}
containerfiles: |
./images/ubuntu-nix-systemd/Containerfile
oci: true
- name: Push To ghcr.io
Expand Down
Loading