Generate all tags in separate bash step and allow multiple major versions to be built in parallel
This commit is contained in:
40
.github/workflows/build.yml
vendored
40
.github/workflows/build.yml
vendored
@@ -7,10 +7,7 @@ on:
|
|||||||
- cron: '20 20 * * *' # 8:20pm everyday
|
- cron: '20 20 * * *' # 8:20pm everyday
|
||||||
env:
|
env:
|
||||||
IMAGE_NAME: base
|
IMAGE_NAME: base
|
||||||
IMAGE_TAGS: 37 latest ${{ github.sha }}
|
|
||||||
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
|
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
|
||||||
REGISTRY_USER: ${{ github.actor }}
|
|
||||||
REGISTRY_PASSWORD: ${{ github.token }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
push-ghcr:
|
push-ghcr:
|
||||||
@@ -18,13 +15,36 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
major_version: [37]
|
||||||
|
include:
|
||||||
|
- major_version: 37
|
||||||
|
is_latest: true
|
||||||
|
is_stable: true
|
||||||
steps:
|
steps:
|
||||||
# Checkout push-to-registry action github repository
|
# Checkout push-to-registry action GitHub repository
|
||||||
- name: Checkout Push to Registry action
|
- name: Checkout Push to Registry action
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: set env
|
- name: set env
|
||||||
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
|
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Generate tags
|
||||||
|
id: generate-tags
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "date=$(date +%Y%m%d)" >> $GITHUB_OUTPUT
|
||||||
|
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
echo "release=${{ matrix.fedora_major_version }}" >> $GITHUB_OUTPUT
|
||||||
|
alias_tags=()
|
||||||
|
if [[ "${{ matrix.is_latest }}" == "true" ]]; then
|
||||||
|
alias_tags+=("latest")
|
||||||
|
fi
|
||||||
|
if [[ "${{ matrix.is_stable }}" == "true" ]]; then
|
||||||
|
alias_tags+=("stable")
|
||||||
|
fi
|
||||||
|
echo "alias_tags=${alias_tags[*]}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# Build image using Buildah action
|
# Build image using Buildah action
|
||||||
- name: Build Image
|
- name: Build Image
|
||||||
id: build_image
|
id: build_image
|
||||||
@@ -33,7 +53,13 @@ jobs:
|
|||||||
containerfiles: |
|
containerfiles: |
|
||||||
./Containerfile
|
./Containerfile
|
||||||
image: ${{ env.IMAGE_NAME }}
|
image: ${{ env.IMAGE_NAME }}
|
||||||
tags: ${{ env.IMAGE_TAGS }} ${{ env.DATE }}
|
tags: |
|
||||||
|
${{ steps.generate-tags.outputs.alias_tags }}
|
||||||
|
${{ steps.generate-tags.outputs.release }}
|
||||||
|
${{ steps.generate-tags.outputs.date }}
|
||||||
|
${{ steps.generate-tags.outputs.sha_short }}
|
||||||
|
build-args: |
|
||||||
|
FEDORA_MAJOR_VERSION=${{ matrix.major_version }}
|
||||||
oci: true
|
oci: true
|
||||||
|
|
||||||
# Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR.
|
# Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR.
|
||||||
@@ -48,6 +74,9 @@ jobs:
|
|||||||
- name: Push To GHCR
|
- name: Push To GHCR
|
||||||
uses: redhat-actions/push-to-registry@v2
|
uses: redhat-actions/push-to-registry@v2
|
||||||
id: push
|
id: push
|
||||||
|
env:
|
||||||
|
REGISTRY_USER: ${{ github.actor }}
|
||||||
|
REGISTRY_PASSWORD: ${{ github.token }}
|
||||||
with:
|
with:
|
||||||
image: ${{ steps.build_image.outputs.image }}
|
image: ${{ steps.build_image.outputs.image }}
|
||||||
tags: ${{ steps.build_image.outputs.tags }}
|
tags: ${{ steps.build_image.outputs.tags }}
|
||||||
@@ -60,4 +89,3 @@ jobs:
|
|||||||
- name: Echo outputs
|
- name: Echo outputs
|
||||||
run: |
|
run: |
|
||||||
echo "${{ toJSON(steps.push.outputs) }}"
|
echo "${{ toJSON(steps.push.outputs) }}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user