Skip to content

MSSQL announcement #429

MSSQL announcement

MSSQL announcement #429

Workflow file for this run

name: Test build Docker image
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
IMAGE: quay.io/elastx/elx-docs
QUAY_USER: elastx+cidocs
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: elastx/actions/docker-lint@main
buildcontent:
name: Hugo build & HTML Proofer
runs-on:
- self-hosted
- non-persistent
needs: lint
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set IMAGE_CI and IMAGE_FULL output parameters
id: ifo
run: |
echo "IMAGE_CI=$IMAGE:ci" >> "$GITHUB_OUTPUT"
echo "IMAGE_FULL=$IMAGE:$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
echo "IMAGE_LATEST=$IMAGE:latest" >> "$GITHUB_OUTPUT"
echo "IMAGE_LATEST_DATED=$IMAGE:latest-$(date +%s)" >> "$GITHUB_OUTPUT"
- name: Set SHOULD_PUSH output parameter
id: spo
run: |
if [ "$GITHUB_REF_NAME" = "master" ]; then
echo "SHOULD_PUSH=true" >> "$GITHUB_OUTPUT"
else
echo "SHOULD_PUSH=false" >> "$GITHUB_OUTPUT"
fi
- name: Docker context
run: docker context create buildctx
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
with:
endpoint: buildctx
- name: Docker login
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ env.QUAY_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Docker build
uses: docker/build-push-action@v5
with:
context: .
push: ${{ steps.spo.outputs.SHOULD_PUSH }}
tags: |
${{ steps.ifo.outputs.IMAGE_CI }}
${{ steps.ifo.outputs.IMAGE_FULL }}
${{ steps.ifo.outputs.IMAGE_LATEST }}
${{ steps.ifo.outputs.IMAGE_LATEST_DATED }}
cache-from: type=registry,ref=${{ steps.ifo.outputs.IMAGE_CI }}
cache-to: type=inline
updateimagetag:
runs-on: ubuntu-latest
needs: buildcontent
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: Override image tag
run: |
pushd k8s/overlays/prod/
kustomize edit set image "${IMAGE}:$(git rev-parse HEAD)"
popd
- name: Git status
run: git status
- name: Push changes to git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Auto updating image tag"
git fetch origin master
git push origin HEAD:master