add workflow
This commit is contained in:
parent
053c80e015
commit
974c60e9af
1 changed files with 39 additions and 0 deletions
|
@ -0,0 +1,39 @@
|
|||
name: Docker Build, Tag, and Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: docker
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- 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 }}
|
||||
|
Loading…
Add table
Reference in a new issue