Skip to content

Build

Build #979

Workflow file for this run

# SPDX-FileCopyrightText: © Vegard IT GmbH (https://vegardit.com)
# SPDX-FileContributor: Sebastian Thomschke
# SPDX-License-Identifier: GPL-2.0-or-later
# SPDX-ArtifactOfProjectHomePage: https://github.com/vegardit/docker-wordpress-ext
#
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: Build
on:
push:
branches:
- '**'
tags-ignore:
- '**'
paths-ignore:
- '**/*.md'
schedule:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
- cron: '0 0 * * *'
workflow_dispatch:
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
env:
DOCKER_IMAGE_REPO: vegardit/wordpress-ext
DOCKER_IMAGE_TAG: latest
TRIVY_CACHE_DIR: ~/.trivy/cache
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4 #https://github.com/actions/checkout
- name: Cache trivy cache
uses: actions/cache@v4
with:
path: ${{ env.TRIVY_CACHE_DIR }}
# https://github.com/actions/cache/issues/342#issuecomment-673371329
key: ${{ runner.os }}-trivy-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-trivy-
- name: Configure Fast APT Mirror
uses: vegardit/fast-apt-mirror.sh@v1
- name: Install dos2unix
run: sudo apt-get install --no-install-recommends -y dos2unix
- name: Build ${{ env.DOCKER_IMAGE_REPO }}:${{ env.DOCKER_IMAGE_TAG }}
shell: bash
env:
DOCKER_REGISTRY: docker.io
DOCKER_REGISTRY_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_REGISTRY_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
TRIVY_GITHUB_TOKEN: ${{ github.token }}
run: |
if [[ $GITHUB_REF_NAME == "main" && $ACT != "true" ]]; then
export DOCKER_PUSH=1
echo "$DOCKER_REGISTRY_TOKEN" | docker login -u="$DOCKER_REGISTRY_USERNAME" "$DOCKER_REGISTRY" --password-stdin
fi
bash build-image.sh