Skip to content

Try

Try #20

Workflow file for this run

name: Deploy
on:
push:
paths:
- "src/**"
- ".github/workflows/**"
pull_request:
paths:
- "src/**"
- ".github/workflows/**"
env:
version: 0.0.${{github.run_number}}
imageRepository: "cjoergensendk/thrifty-elastic-alerting"
DOCKER_CLI_EXPERIMENTAL: "enabled"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Set short SHA
id: vars
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_OUTPUT
shell: bash
- name: Build image
shell: bash
run: docker build -t ${{env.imageRepository}}:${{ github.sha }} -f ./src/Kibana.Alerts/Dockerfile ./src/Kibana.Alerts/
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "docker - tag and push"
run: |
# docker pull ${{env.imageRepository}}:build-${{env.version}}-amd64
# docker manifest create ${{env.imageRepository}}:${{env.version}} ${{env.imageRepository}}:build-${{env.version}}-amd64
# docker manifest create ${{env.imageRepository}}:latest ${{env.imageRepository}}:build-${{env.version}}-amd64
# docker manifest push ${{env.imageRepository}}:${{env.version}}
# docker manifest push ${{env.imageRepository}}:latest
docker tag ${{env.imageRepository}}:${{ github.sha }} ${{env.imageRepository}}:latest
docker tag ${{env.imageRepository}}:${{ github.sha }} ${{env.imageRepository}}:${{env.version}}
docker tag ${{env.imageRepository}}:${{ github.sha }} ${{env.imageRepository}}:${{ steps.vars.outputs.SHORT_SHA }}
docker push --all-tags ${{env.imageRepository}}