ansible-bws/.forgejo/workflows/build.yml

37 lines
741 B
YAML
Raw Normal View History

2025-01-13 01:39:47 -05:00
name: Docker Build, Tag, and Deploy
on:
push:
branches:
2025-01-13 01:54:50 -05:00
- master
2025-01-13 01:39:47 -05:00
jobs:
build:
runs-on: docker
steps:
- name: Checkout code
2025-01-13 01:57:21 -05:00
uses: actions/checkout@v4
2025-01-13 01:39:47 -05:00
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: mafyuh
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get the current Git tag
id: get_tag
run: |
TAG=$(git describe --tags --abbrev=0)
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Build Docker image
run: |
IMAGE_TAG="mafyuh/ansible-bws:${{ env.TAG }}"
docker build -t $IMAGE_TAG .
- name: Push Docker image to Docker Hub
run: |
docker push mafyuh/ansible-bws:${{ env.TAG }}