diff --git a/.github/workflows/publishimage.yml b/.github/workflows/publishimage-fiware.yml similarity index 89% rename from .github/workflows/publishimage.yml rename to .github/workflows/publishimage-fiware.yml index af56a99bae..07f10beb01 100644 --- a/.github/workflows/publishimage.yml +++ b/.github/workflows/publishimage-fiware.yml @@ -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 diff --git a/.github/workflows/publishimage-master.yml b/.github/workflows/publishimage-master.yml index a238eb15fb..2811dea64f 100644 --- a/.github/workflows/publishimage-master.yml +++ b/.github/workflows/publishimage-master.yml @@ -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: @@ -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 diff --git a/.github/workflows/publishimage-tag.yml b/.github/workflows/publishimage-tag.yml new file mode 100644 index 0000000000..6cd6b94b40 --- /dev/null +++ b/.github/workflows/publishimage-tag.yml @@ -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 }}