build(deps): bump library/alpine from 3.20.3 to 3.21.0 (#130) #462
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: Build | |
on: | |
pull_request: | |
branches: [master] | |
push: | |
branches: [master] | |
workflow_dispatch: | |
inputs: | |
ssh_debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
jobs: | |
build_bases: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ["experimental", "stable", "legacy"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: FranzDiebold/[email protected] | |
- name: Set Humhub version | |
run: | | |
HUMHUB_VERSION="$(awk -e '$0 ~ /^([0-9\.]+) [0-9\.]+ ${{ matrix.version }}/ {print $1}' versions.txt)" | |
export HUMHUB_VERSION | |
echo "HUMHUB_VERSION=$HUMHUB_VERSION" >> "$GITHUB_ENV" | |
GIT_REV=$(git rev-parse --short HEAD) | |
export GIT_REV | |
echo "GIT_REV=$GIT_REV" >> "$GITHUB_ENV" | |
- name: Build and push docker image | |
run: | | |
docker build \ | |
--build-arg HUMHUB_VERSION="${HUMHUB_VERSION}" \ | |
--build-arg VCS_REF="${GIT_REV}" \ | |
--build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ | |
--target base \ | |
-t "ghcr.io/${CI_REPOSITORY_OWNER}/humhub:${CI_REF_NAME_SLUG}-${HUMHUB_VERSION}-git-${GIT_REV}-base" \ | |
. | |
docker save "ghcr.io/${CI_REPOSITORY_OWNER}/humhub:${CI_REF_NAME_SLUG}-${HUMHUB_VERSION}-git-${GIT_REV}-base" \ | |
| gzip > "build-${{ matrix.version }}-git-${GIT_REV}.tar.gz" | |
- name: Upload image archive | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ matrix.version }}-git-${{ env.GIT_REV }} | |
path: build-${{ matrix.version }}-git-${{ env.GIT_REV }}.tar.gz | |
build_variants: | |
needs: build_bases | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ["experimental", "stable", "legacy"] | |
target: ["allinone", "nginx", "phponly"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: FranzDiebold/[email protected] | |
- name: Set Humhub version | |
run: | | |
HUMHUB_VERSION="$(awk -e '$0 ~ /^([0-9\.]+) [0-9\.]+ ${{ matrix.version }}/ {print $1}' versions.txt)" | |
export HUMHUB_VERSION | |
echo "HUMHUB_VERSION=$HUMHUB_VERSION" >> "$GITHUB_ENV" | |
GIT_REV=$(git rev-parse --short HEAD) | |
export GIT_REV | |
echo "GIT_REV=$GIT_REV" >> "$GITHUB_ENV" | |
- name: Download image archive | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-${{ matrix.version }}-git-${{ env.GIT_REV }} | |
- name: Build and push docker image | |
run: | | |
docker load --input "build-${{ matrix.version }}-git-${GIT_REV}.tar.gz" | |
docker build \ | |
--build-arg HUMHUB_VERSION="${HUMHUB_VERSION}" \ | |
--build-arg VCS_REF="${GIT_REV}" \ | |
--target "humhub_${{ matrix.target }}" \ | |
-t "ghcr.io/${CI_REPOSITORY_OWNER}/humhub:${CI_REF_NAME_SLUG}-${HUMHUB_VERSION}-git-${GIT_REV}-${{ matrix.target }}" \ | |
. | |
docker save "ghcr.io/${CI_REPOSITORY_OWNER}/humhub:${CI_REF_NAME_SLUG}-${HUMHUB_VERSION}-git-${GIT_REV}-${{ matrix.target }}" \ | |
| gzip > "build-${{ matrix.version }}-git-${{ env.GIT_REV }}-${{ matrix.target }}.tar.gz" | |
- name: Upload image archive | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ matrix.version }}-git-${{ env.GIT_REV }}-${{ matrix.target }} | |
path: build-${{ matrix.version }}-git-${{ env.GIT_REV }}-${{ matrix.target }}.tar.gz | |
test_aio: | |
needs: build_variants | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ["experimental", "stable", "legacy"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: FranzDiebold/[email protected] | |
- name: Set Humhub version | |
run: | | |
HUMHUB_VERSION="$(awk -e '$0 ~ /^([0-9\.]+) [0-9\.]+ ${{ matrix.version }}/ {print $1}' versions.txt)" | |
export HUMHUB_VERSION | |
echo "HUMHUB_VERSION=$HUMHUB_VERSION" >> "$GITHUB_ENV" | |
GIT_REV=$(git rev-parse --short HEAD) | |
export GIT_REV | |
echo "GIT_REV=$GIT_REV" >> "$GITHUB_ENV" | |
- name: Download image archive | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-${{ matrix.version }}-git-${{ env.GIT_REV }}-allinone | |
- name: Load images | |
run: | | |
docker load --input "build-${{ matrix.version }}-git-${GIT_REV}-allinone.tar.gz" | |
- name: replace image | |
run: sed -i "s/docker.io\/mriedmann\/humhub:latest/ghcr.io\/${CI_REPOSITORY_OWNER}\/humhub:${CI_REF_NAME_SLUG}-${HUMHUB_VERSION}-git-${GIT_REV}-allinone/g" docker-compose.yml | |
- name: Spin up services | |
run: docker compose -f docker-compose.yml up -d | |
- name: Wait | |
run: sleep 120 | |
- name: Check status | |
run: docker ps -a | |
- name: Collect startup logs from all containers | |
run: docker compose -f docker-compose.prod.yml logs | |
- name: Setup upterm SSH debugging | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.ssh_debug_enabled }} | |
- name: Test | |
run: curl 'http://localhost:8080/' --location --fail --silent | grep 'Sign in</button>' -q || ( curl 'http://localhost:8080/' --trace - ; exit 1;) | |
- name: Test Email | |
run: docker compose exec -T humhub php /var/www/localhost/htdocs/protected/yii test/email '[email protected]' --interactive=0 \ | |
| grep 'Message successfully sent!' -q | |
- name: Collect HumHub server logs | |
if: ${{ always() }} | |
run: docker logs humhub-docker-humhub-1 | |
test_prod: | |
needs: build_variants | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ["experimental", "stable", "legacy"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: FranzDiebold/[email protected] | |
- name: Set Humhub version | |
run: | | |
HUMHUB_VERSION="$(awk -e '$0 ~ /^([0-9\.]+) [0-9\.]+ ${{ matrix.version }}/ {print $1}' versions.txt)" | |
export HUMHUB_VERSION | |
echo "HUMHUB_VERSION=$HUMHUB_VERSION" >> "$GITHUB_ENV" | |
GIT_REV=$(git rev-parse --short HEAD) | |
export GIT_REV | |
echo "GIT_REV=$GIT_REV" >> "$GITHUB_ENV" | |
- name: Download image archive (phponly) | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-${{ matrix.version }}-git-${{ env.GIT_REV }}-phponly | |
- name: Download image archive (nginx) | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-${{ matrix.version }}-git-${{ env.GIT_REV }}-nginx | |
- name: Load images | |
run: | | |
docker load --input "build-${{ matrix.version }}-git-${GIT_REV}-phponly.tar.gz" | |
docker load --input "build-${{ matrix.version }}-git-${GIT_REV}-nginx.tar.gz" | |
- name: replace image | |
run: | | |
sed -i "s/docker.io\/mriedmann\/humhub:stable-nginx/ghcr.io\/${CI_REPOSITORY_OWNER}\/humhub:${CI_REF_NAME_SLUG}-${HUMHUB_VERSION}-git-${GIT_REV}-nginx/g" docker-compose.prod.yml | |
sed -i "s/docker.io\/mriedmann\/humhub:stable-phponly/ghcr.io\/${CI_REPOSITORY_OWNER}\/humhub:${CI_REF_NAME_SLUG}-${HUMHUB_VERSION}-git-${GIT_REV}-phponly/g" docker-compose.prod.yml | |
- name: Spin up services | |
run: docker compose -f docker-compose.prod.yml up -d | |
- name: Wait | |
run: sleep 120 | |
- name: Check status | |
run: docker ps -a | |
- name: Collect startup logs from all containers | |
run: docker compose -f docker-compose.prod.yml logs | |
- name: Setup upterm SSH debugging | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.ssh_debug_enabled }} | |
- name: Test | |
run: curl 'http://localhost:8080/' --location --fail --silent | grep 'Sign in</button>' -q || ( curl 'http://localhost:8080/' --trace - ; exit 1;) | |
- name: Test Email | |
run: | | |
docker compose exec -T humhub php /var/www/localhost/htdocs/protected/yii test/email '[email protected]' --interactive=0 \ | |
| grep 'Message successfully sent!' -q | |
- name: Collect HumHub server logs | |
if: ${{ always() }} | |
run: docker logs humhub-docker-humhub-1 | |
push_ghcr: | |
needs: ["test_aio", "test_prod"] | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/master' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ["experimental", "stable", "legacy"] | |
target: ["allinone"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: FranzDiebold/[email protected] | |
- name: Login to registry | |
run: echo "${{ secrets.PAT }}" | docker login ghcr.io --username "${GITHUB_REPOSITORY_OWNER}" --password-stdin | |
- name: Set Humhub version | |
run: | | |
HUMHUB_VERSION="$(awk -e '$0 ~ /^([0-9\.]+) [0-9\.]+ ${{ matrix.version }}/ {print $1}' versions.txt)" | |
export HUMHUB_VERSION | |
echo "HUMHUB_VERSION=$HUMHUB_VERSION" >> "$GITHUB_ENV" | |
GIT_REV=$(git rev-parse --short HEAD) | |
export GIT_REV | |
echo "GIT_REV=$GIT_REV" >> "$GITHUB_ENV" | |
- name: Download image archive | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-${{ matrix.version }}-git-${{ env.GIT_REV }}-${{ matrix.target }} | |
- name: Load, retag and Push images | |
run: | | |
export REPO_OWNER="ghcr.io/${GITHUB_REPOSITORY_OWNER}" | |
export IMAGE_URL="${REPO_OWNER}/humhub:${CI_REF_NAME_SLUG}-${HUMHUB_VERSION}-git-${GIT_REV}-${{ matrix.target }}" | |
docker load --input "build-${{ matrix.version }}-git-${GIT_REV}-${{ matrix.target }}.tar.gz" | |
docker tag "${IMAGE_URL}" "${REPO_OWNER}/humhub-${{ matrix.target }}:${HUMHUB_VERSION}-git-${GIT_REV}" | |
docker tag "${IMAGE_URL}" "${REPO_OWNER}/humhub-${{ matrix.target }}:latest" | |
docker push "ghcr.io/${CI_REPOSITORY_OWNER}/humhub-${{ matrix.target }}:${HUMHUB_VERSION}-git-${GIT_REV}" |