Skip to content

Commit

Permalink
ADD GitAction for build docker for tags
Browse files Browse the repository at this point in the history
  • Loading branch information
fgalan committed May 17, 2024
1 parent e789afc commit 7281e1f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Publish pre Image from master
name: Publish pre Image from master in FIWARE dockerhub

# The workflow will push PRE images from master on every merge. The images will be tagged with PRE and the next minor increase on the
# The workflow will push PRE images from master on every merge to the fiware dockerhub organization. The images will be tagged with PRE and the next minor increase on the
# semver(based on the github releases)
# It will NOT produce releases and release images or the 'latest' tag from master. Both (releases and 'latest' tag) rely on the
# dockerhub autobuild feature
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/publishimage-master.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: Publish Docker image (master)

# The workflow will push images on every tag in the format x.y.z
# FIXME PR: change label and branch before merging into master
# The workflow will push images for master on every merge

on:
push:
branches:
#- master
- feature/4004_jexl_expressions
- master

jobs:
build-and-push:
Expand All @@ -27,9 +25,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TEF_TOKEN }}

- name: Build Docker image
#run: docker build -t telefonicaiot/fiware-orion:latest --build-arg GIT_REV_ORION=master --build-arg REPO_ACCESS_TOKEN=${{ secrets.REPO_ACCESS_TOKEN }} --no-cache -f docker/Dockerfile .
run: docker build -t telefonicaiot/fiware-orion:jexl --build-arg GIT_REV_ORION=feature/4004_jexl_expressions --build-arg REPO_ACCESS_TOKEN=${{ secrets.REPO_ACCESS_TOKEN }} --no-cache -f docker/Dockerfile .
run: docker build -t telefonicaiot/fiware-orion:latest --build-arg GIT_REV_ORION=master --build-arg REPO_ACCESS_TOKEN=${{ secrets.REPO_ACCESS_TOKEN }} --no-cache -f docker/Dockerfile .

- name: Push Docker image
#run: docker push telefonicaiot/fiware-orion:latest
run: docker push telefonicaiot/fiware-orion:jexl
run: docker push telefonicaiot/fiware-orion:latest
35 changes: 35 additions & 0 deletions .github/workflows/publishimage-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Docker image (tag)

# The workflow will push images on every tag in the format x.y.z

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_TEF_USERNAME }}
password: ${{ secrets.DOCKERHUB_TEF_TOKEN }}

- name: Extract version from tag
id: extract_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Build Docker image
run: docker build -t telefonicaiot/fiware-orion:${{ env.VERSION }} --build-arg GIT_REV_ORION=${{ env.VERSION }} --build-arg REPO_ACCESS_TOKEN=${{ secrets.REPO_ACCESS_TOKEN }} --no-cache -f docker/Dockerfile .

- name: Push Docker image
run: docker push telefonicaiot/fiware-orion:${{ env.VERSION }}

0 comments on commit 7281e1f

Please sign in to comment.