change: publish in workflow #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Docker Images | |
on: | |
push: | |
branches: | |
- main | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Login to Docker Hub | |
run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | |
- name: Build and push Docker images | |
run: | | |
activemq_java8_versions=(5.16.0 5.16.1 5.16.2 5.16.3 5.16.4 5.16.5 5.16.6 5.16.7) | |
for version in "${activemq_java8_versions[@]}" ; do | |
docker manifest inspect dinifarb/activemq:$version > /dev/null | |
if [ $? -ne 0 ]; then | |
echo "Publishing version $version" | |
docker build -t dinifarb/activemq:$version --build-arg ACTIVEMQ_VERSION=$version . | |
docker push dinifarb/activemq:$version | |
fi | |
done | |
activemq_java11_versions=(5.17.0 5.17.1 5.17.2 5.17.3 5.17.4 5.17.5 5.17.6 5.18.0 5.18.1 5.18.2 5.18.3) | |
for version in "${activemq_java11_versions[@]}" ; do | |
docker manifest inspect dinifarb/activemq:$version > /dev/null | |
if [ $? -ne 0 ]; then | |
echo "Publishing version $version" | |
docker build -t dinifarb/activemq:$version --build-arg ACTIVEMQ_VERSION=$version --build-arg JAVA_VERSION=11 . | |
docker push dinifarb/activemq:$version | |
fi | |
done | |
activemq_java17_versions=(6.0.0 6.0.1) | |
for version in "${activemq_java17_versions[@]}" ; do | |
docker manifest inspect dinifarb/activemq:$version > /dev/null | |
if [ $? -ne 0 ]; then | |
echo "Publishing version $version" | |
docker build -t dinifarb/activemq:$version --build-arg ACTIVEMQ_VERSION=$version --build-arg JAVA_VERSION=17 . | |
docker push dinifarb/activemq:$version | |
fi | |
done |