mirror of
https://github.com/vegardit/docker-openldap.git
synced 2026-05-21 12:14:16 +02:00
update gha workflow
This commit is contained in:
parent
94eeebad3e
commit
0a7b88c2ec
34
.github/workflows/build.yml
vendored
34
.github/workflows/build.yml
vendored
|
|
@ -8,25 +8,36 @@ name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: # build all branches
|
||||||
- '**'
|
- '**'
|
||||||
tags-ignore:
|
tags-ignore: # but don't build tags
|
||||||
- '**'
|
- '**'
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**/*.md'
|
- '**/*.md'
|
||||||
|
- '.github/*.yml'
|
||||||
schedule:
|
schedule:
|
||||||
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
|
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
|
||||||
- cron: '0 0 * * *'
|
- cron: '0 0 * * *'
|
||||||
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
|
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
DOCKER_IMAGE_REPO: vegardit/openldap
|
||||||
TRIVY_CACHE_DIR: ~/.trivy/cache
|
TRIVY_CACHE_DIR: ~/.trivy/cache
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Show environment variables
|
||||||
|
run: env | sort
|
||||||
|
|
||||||
- name: Git Checkout
|
- name: Git Checkout
|
||||||
uses: actions/checkout@v3 #https://github.com/actions/checkout
|
uses: actions/checkout@v3 #https://github.com/actions/checkout
|
||||||
|
|
||||||
|
|
@ -45,16 +56,21 @@ jobs:
|
||||||
- name: Install dos2unix
|
- name: Install dos2unix
|
||||||
run: sudo apt-get install --no-install-recommends -y dos2unix
|
run: sudo apt-get install --no-install-recommends -y dos2unix
|
||||||
|
|
||||||
|
- name: Install regclient
|
||||||
|
if: ${{ github.ref_name == 'main' && github.event_name != 'pull_request' && !env.ACT }} # https://github.com/nektos/act#skipping-steps
|
||||||
|
uses: iarekylew00t/regctl-installer@v1
|
||||||
|
|
||||||
|
- name: Login to docker.io
|
||||||
|
if: ${{ github.ref_name == 'main' && github.event_name != 'pull_request' && !env.ACT }} # https://github.com/nektos/act#skipping-steps
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build docker image
|
- name: Build docker image
|
||||||
shell: bash
|
|
||||||
env:
|
env:
|
||||||
DOCKER_REGISTRY: docker.io
|
DOCKER_REGISTRY: docker.io
|
||||||
DOCKER_REGISTRY_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
|
DOCKER_PUSH: ${{ github.ref_name == 'main' && github.event_name != 'pull_request' && !env.ACT }}
|
||||||
DOCKER_REGISTRY_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
|
|
||||||
TRIVY_GITHUB_TOKEN: ${{ github.token }}
|
TRIVY_GITHUB_TOKEN: ${{ github.token }}
|
||||||
run: |
|
run: |
|
||||||
if [ "$GITHUB_REF" == "refs/heads/main" ]; then
|
|
||||||
export DOCKER_PUSH=1
|
|
||||||
fi
|
|
||||||
echo "$DOCKER_REGISTRY_TOKEN" | docker login -u="$DOCKER_REGISTRY_USERNAME" "$DOCKER_REGISTRY" --password-stdin
|
|
||||||
bash build-image.sh
|
bash build-image.sh
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue