Skip to content

CI-Build

CI-Build #1

Workflow file for this run

name: CI-Build
on:
pull_request:
types: [ closed ]
branches: [ master ]
permissions:
contents: write
jobs:
build-push:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CI:Build')
name: Build
runs-on: ubuntu-24.04
environment: dev
env:
ENVIRONMENT: dev
REPO_NAME: ${{ github.event.repository.name }}
steps:
- name: Checkout the repo
uses: actions/checkout@v4
with:
ref: master
- name: Autotag
id: autotag
uses: anothrNick/github-tag-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: false
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}
- name: Build and push to Docker Hub
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}:${{ env.ENVIRONMENT }}-latest,${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}:${{ env.ENVIRONMENT }}-${{ steps.autotag.outputs.tag }}
labels: ${{ steps.metadata.outputs.labels }}