Skip to content

Commit

Permalink
Scheduled rebuild of latest images (#186)
Browse files Browse the repository at this point in the history
* Build experimental images quarterly
* Test experimental images before publishing them.
* Build latest tag weekly
  • Loading branch information
ckulka authored May 4, 2024
1 parent a5a2d6e commit dd8be89
Show file tree
Hide file tree
Showing 6 changed files with 224 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,75 @@
name: Build experimental images

on:
# Rebuild every quarter on Sunday at 8:20 UTC
schedule:
- cron: 20 8 * 1/3 0

# Build on push to master
push:
branches:
- master
paths:
- .github/workflows/docker-build.yml
- .github/workflows/build-experimental.yaml
- "*.dockerfile"
- files/**

# Run the automated tests first, then publish the images if the tests pass
jobs:
test:
name: ${{ matrix.dockerfile }}
uses: ./.github/workflows/test-job.yaml
with:
dockerfile: ${{ matrix.dockerfile }}
strategy:
fail-fast: true
matrix:
dockerfile:
- apache
- apache-php8.2
- nginx
- nginx-php8.2

apache:
name: Apache
needs: test
uses: ./.github/workflows/build-job.yaml
with:
dockerfile: apache.dockerfile
baikal-version: experimental
image-version: experimental
tags: |
ckulka/baikal:experimental-apache
ckulka/baikal:experimental
secrets: inherit

apache_php82:
name: Apache (PHP 8.2)
needs: test
uses: ./.github/workflows/build-job.yaml
with:
dockerfile: apache-php8.2.dockerfile
baikal-version: experimental
image-version: experimental
tags: |
ckulka/baikal:experimental-apache-php8.2
ckulka/baikal:experimental-php8.2
secrets: inherit

nginx:
name: Nginx
needs: test
uses: ./.github/workflows/build-job.yaml
with:
dockerfile: nginx.dockerfile
baikal-version: experimental
image-version: experimental
tags: ckulka/baikal:experimental-nginx
secrets: inherit

nginx_php82:
name: Apache (PHP 8.2)
name: Nginx (PHP 8.2)
needs: test
uses: ./.github/workflows/build-job.yaml
with:
dockerfile: nginx-php8.2.dockerfile
baikal-version: experimental
image-version: experimental
tags: ckulka/baikal:experimental-nginx-php8.2
secrets: inherit
17 changes: 13 additions & 4 deletions .github/workflows/build-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@ on:
description: Tags to apply to the image
required: true
type: string
baikal-version:
description: Baikal version
image-version:
description: Value for org.opencontainers.image.version label
required: true
type: string
image-revision:
description: Value for org.opencontainers.image.revision label
default: ${{ github.sha }}
type: string
ref:
description: Git reference to build
default: ${{ github.ref }}
type: string
secrets:
DOCKERHUB_USERNAME:
description: DockerHub username
Expand All @@ -28,6 +36,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
show-progress: false

# See https://github.com/docker/setup-qemu-action
Expand Down Expand Up @@ -58,8 +67,8 @@ jobs:
org.opencontainers.image.url=https://hub.docker.com/r/ckulka/baikal
org.opencontainers.image.documentation=https://github.com/ckulka/baikal-docker
org.opencontainers.image.source=https://github.com/ckulka/baikal-docker
org.opencontainers.image.version=${{ inputs.baikal-version }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ inputs.image-version }}
org.opencontainers.image.revision=${{ inputs.image-revision }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.title=Baikal
org.opencontainers.image.description=Ready-to-go Baikal server
117 changes: 117 additions & 0 deletions .github/workflows/build-latest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# See
# - https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
# - https://docs.github.com/en/actions/learn-github-actions/contexts
# - https://github.com/docker/build-push-action/blob/master/docs/advanced/multi-platform.md
name: Build release images

on:
# Rebuild every week on Sunday at 8:20 UTC
schedule:
- cron: 20 8 * * 0

# Build when a release is published
release:
types:
- published

# Allow manually triggered rebuilds
workflow_dispatch:

jobs:
parse_release_tag:
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.parse-release-tag.outputs.REF_NAME }}
baikal-version: ${{ steps.parse-release-tag.outputs.BAIKAL_VERSION }}
steps:
- name: Parse release tag
id: parse-release-tag
run: |
if [ "${{ github.event_name }}" == "release" ]
then
# Get the release version by stripping build metadata from the release name
echo Parsing tag from release ref $REF_NAME
REF_NAME=$GITHUB_REF_NAME
else
# Get the latest release version from the GitHub API
echo Parsing tag from latest release ref $REF_NAME
REF_NAME=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name')
fi
BAIKAL_VERSION=${REF_NAME/+*/}
echo Parsed Baikal version $BAIKAL_VERSION from release $REF_NAME
echo REF_NAME=$REF_NAME >> "$GITHUB_OUTPUT"
echo BAIKAL_VERSION=$BAIKAL_VERSION >> "$GITHUB_OUTPUT"
test:
name: ${{ matrix.dockerfile }}
needs: parse_release_tag
uses: ./.github/workflows/test-job.yaml
with:
dockerfile: ${{ matrix.dockerfile }}
ref: ${{ needs.parse_release_tag.outputs.ref }}
strategy:
fail-fast: true
matrix:
dockerfile:
- apache
- apache-php8.2
- nginx
- nginx-php8.2

apache:
name: Apache
needs:
- parse_release_tag
- test
uses: ./.github/workflows/build-job.yaml
with:
ref: ${{ needs.parse_release_tag.outputs.ref }}
dockerfile: apache.dockerfile
image-version: ${{ needs.parse_release_tag.outputs.baikal-version }}
tags: |
ckulka/baikal:apache
ckulka/baikal:latest
secrets: inherit

apache_php82:
name: Apache (PHP 8.2)
needs:
- parse_release_tag
- test
uses: ./.github/workflows/build-job.yaml
with:
ref: ${{ needs.parse_release_tag.outputs.ref }}
dockerfile: apache-php8.2.dockerfile
image-version: ${{ needs.parse_release_tag.outputs.baikal-version }}
image-revision: ${{ needs.parse_release_tag.outputs.ref }}
tags: ckulka/baikal:apache-php8.2
secrets: inherit

nginx:
name: Nginx
needs:
- parse_release_tag
- test
uses: ./.github/workflows/build-job.yaml
with:
ref: ${{ needs.parse_release_tag.outputs.ref }}
dockerfile: nginx.dockerfile
image-version: ${{ needs.parse_release_tag.outputs.baikal-version }}
image-revision: ${{ needs.parse_release_tag.outputs.ref }}
tags: ckulka/baikal:nginx
secrets: inherit

nginx_php82:
name: Nginx (PHP 8.2)
needs:
- parse_release_tag
- test
uses: ./.github/workflows/build-job.yaml
with:
ref: ${{ needs.parse_release_tag.outputs.ref }}
dockerfile: nginx-php8.2.dockerfile
image-version: ${{ needs.parse_release_tag.outputs.baikal-version }}
image-revision: ${{ needs.parse_release_tag.outputs.ref }}
tags: ckulka/baikal:nginx-php8.2
secrets: inherit
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,27 @@ on:
types:
- published

workflow_dispatch:

jobs:
parse_release_tag:
if: github.event_name == 'release'
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.parse-release-tag.outputs.tag }}
baikal-version: ${{ steps.parse-release-tag.outputs.BAIKAL_VERSION }}
steps:
# Get the release version by stripping build metadata from the release name
- name: Parse release tag
id: parse-release-tag
run: echo tag=${GITHUB_REF_NAME/+*/} >> "$GITHUB_OUTPUT"
run: echo BAIKAL_VERSION=${GITHUB_REF_NAME/+*/} >> "$GITHUB_OUTPUT"

apache:
name: Apache
needs: parse_release_tag
uses: ./.github/workflows/build-job.yaml
with:
dockerfile: apache.dockerfile
baikal-version: ${{ github.ref_name }}
image-version: ${{ needs.parse_release_tag.outputs.baikal-version }}
tags: |
ckulka/baikal:${{ needs.parse_release_tag.outputs.tag }}-apache
ckulka/baikal:${{ needs.parse_release_tag.outputs.tag }}
ckulka/baikal:apache
ckulka/baikal:latest
ckulka/baikal:${{ needs.parse_release_tag.outputs.baikal-version }}-apache
ckulka/baikal:${{ needs.parse_release_tag.outputs.baikal-version }}
secrets: inherit

apache_php82:
Expand All @@ -43,11 +38,10 @@ jobs:
uses: ./.github/workflows/build-job.yaml
with:
dockerfile: apache-php8.2.dockerfile
baikal-version: ${{ github.ref_name }}
image-version: ${{ needs.parse_release_tag.outputs.baikal-version }}
tags: |
ckulka/baikal:${{ needs.parse_release_tag.outputs.tag }}-apache-php8.2
ckulka/baikal:${{ needs.parse_release_tag.outputs.tag }}-php8.2
ckulka/baikal:apache-php8.2
ckulka/baikal:${{ needs.parse_release_tag.outputs.baikal-version }}-apache-php8.2
ckulka/baikal:${{ needs.parse_release_tag.outputs.baikal-version }}-php8.2
secrets: inherit

nginx:
Expand All @@ -56,10 +50,8 @@ jobs:
uses: ./.github/workflows/build-job.yaml
with:
dockerfile: nginx.dockerfile
baikal-version: ${{ github.ref_name }}
tags: |
ckulka/baikal:${{ needs.parse_release_tag.outputs.tag }}-nginx
ckulka/baikal:nginx
image-version: ${{ needs.parse_release_tag.outputs.baikal-version }}
tags: ckulka/baikal:${{ needs.parse_release_tag.outputs.baikal-version }}-nginx
secrets: inherit

nginx_php82:
Expand All @@ -68,6 +60,6 @@ jobs:
uses: ./.github/workflows/build-job.yaml
with:
dockerfile: nginx-php8.2.dockerfile
baikal-version: ${{ github.ref_name }}
tags: ckulka/baikal:${{ needs.parse_release_tag.outputs.tag }}-nginx-php8.2
image-version: ${{ needs.parse_release_tag.outputs.baikal-version }}
tags: ckulka/baikal:${{ needs.parse_release_tag.outputs.baikal-version }}-nginx-php8.2
secrets: inherit
36 changes: 36 additions & 0 deletions .github/workflows/pr-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: PR review

on:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
show-progress: false

- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: npm

- name: Install Cypress dependencies
run: npm ci

- name: Ensure files follow code style
run: npm run lint

test:
uses: ./.github/workflows/test-job.yaml
with:
dockerfile: ${{ matrix.dockerfile }}
strategy:
fail-fast: true
matrix:
dockerfile:
- apache
- apache-php8.2
- nginx
- nginx-php8.2
Loading

0 comments on commit dd8be89

Please sign in to comment.