Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 61 additions & 5 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,40 +35,96 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup variables
run: |
# set as GitHub ENV variables
echo "cli_version=$(\./mvnw -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[')" >> $GITHUB_ENV
echo "build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_ENV
echo "DOCKER_GENERATOR_IMAGE_NAME=openapitools/openapi-generator-online" >> $GITHUB_ENV
echo "DOCKER_CODEGEN_CLI_IMAGE_NAME=openapitools/openapi-generator-cli" >> $GITHUB_ENV
echo "GHCR_GENERATOR_IMAGE_NAME=ghcr.io/openapitools/openapi-generator-online" >> $GITHUB_ENV
echo "GHCR_CODEGEN_CLI_IMAGE_NAME=ghcr.io/openapitools/openapi-generator-cli" >> $GITHUB_ENV

# online images
- name: Publish openapi-generator-online snapshot version
if: github.ref_type != 'tag' # not tag (release)
run: |
docker buildx create --use
docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=${{ env.build_date }} --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$GITHUB_SHA --label=org.opencontainers.image.version=${{ env.cli_version }} -t ${{ env.DOCKER_GENERATOR_IMAGE_NAME }} ./modules/openapi-generator-online
docker buildx build \
--push \
--platform linux/amd64,linux/arm64 \
--label=org.opencontainers.image.created=${{ env.build_date }} \
--label=org.opencontainers.image.title=openapi-generator-online \
--label=org.opencontainers.image.revision=$GITHUB_SHA \
--label=org.opencontainers.image.version=${{ env.cli_version }} \
-t ${{ env.DOCKER_GENERATOR_IMAGE_NAME }} \
-t ${{ env.GHCR_GENERATOR_IMAGE_NAME }} \
./modules/openapi-generator-online
- name: Publish openapi-generator-online stable version
if: github.ref_type == 'tag' # tagged (release)
run: |
docker buildx create --use
docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=${{ env.build_date }} --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$GITHUB_SHA --label=org.opencontainers.image.version=${{ env.cli_version }} -t ${{ env.DOCKER_GENERATOR_IMAGE_NAME }}:latest -t ${{ env.DOCKER_GENERATOR_IMAGE_NAME }}:${{ github.ref_name }} -t ${{ env.DOCKER_GENERATOR_IMAGE_NAME }} -t ${{ env.DOCKER_GENERATOR_IMAGE_NAME }}:latest-release ./modules/openapi-generator-online
docker buildx build \
--push \
--platform linux/amd64,linux/arm64 \
--label=org.opencontainers.image.created=${{ env.build_date }} \
--label=org.opencontainers.image.title=openapi-generator-online \
--label=org.opencontainers.image.revision=$GITHUB_SHA \
--label=org.opencontainers.image.version=${{ env.cli_version }} \
-t ${{ env.DOCKER_GENERATOR_IMAGE_NAME }}:latest \
-t ${{ env.DOCKER_GENERATOR_IMAGE_NAME }}:${{ github.ref_name }} \
-t ${{ env.DOCKER_GENERATOR_IMAGE_NAME }} \
-t ${{ env.DOCKER_GENERATOR_IMAGE_NAME }}:latest-release \
-t ${{ env.GHCR_GENERATOR_IMAGE_NAME }}:latest \
-t ${{ env.GHCR_GENERATOR_IMAGE_NAME }}:${{ github.ref_name }} \
-t ${{ env.GHCR_GENERATOR_IMAGE_NAME }} \
-t ${{ env.GHCR_GENERATOR_IMAGE_NAME }}:latest-release \
./modules/openapi-generator-online

# cli images
- name: Publish openapi-generator-cli snapshot version
if: github.ref_type != 'tag' # not tag (release)
run: |
cp docker-entrypoint.sh ./modules/openapi-generator-cli
docker buildx create --use
docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=${{ env.build_date }} --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$GITHUB_SHA --label=org.opencontainers.image.version=${{ env.cli_version }} -t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }} ./modules/openapi-generator-cli
docker buildx build \
--push \
--platform linux/amd64,linux/arm64 \
--label=org.opencontainers.image.created=${{ env.build_date }} \
--label=org.opencontainers.image.title=openapi-generator-cli \
--label=org.opencontainers.image.revision=$GITHUB_SHA \
--label=org.opencontainers.image.version=${{ env.cli_version }} \
-t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }} \
-t ${{ env.GHCR_CODEGEN_CLI_IMAGE_NAME }} \
./modules/openapi-generator-cli
- name: Publish openapi-generator-cli stable version
if: github.ref_type == 'tag' # tagged (release)
run: |
cp docker-entrypoint.sh ./modules/openapi-generator-cli
docker buildx create --use
docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=${{ env.build_date }} --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$GITHUB_SHA --label=org.opencontainers.image.version=${{ env.cli_version }} -t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }}:latest -t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }}:${{ github.ref_name }} -t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }} -t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }}:latest-release ./modules/openapi-generator-cli
docker buildx build \
--push \
--platform linux/amd64,linux/arm64 \
--label=org.opencontainers.image.created=${{ env.build_date }} \
--label=org.opencontainers.image.title=openapi-generator-cli \
--label=org.opencontainers.image.revision=$GITHUB_SHA \
--label=org.opencontainers.image.version=${{ env.cli_version }} \
-t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }}:latest \
-t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }}:${{ github.ref_name }} \
-t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }} \
-t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }}:latest-release \
-t ${{ env.GHCR_CODEGEN_CLI_IMAGE_NAME }}:latest \
-t ${{ env.GHCR_CODEGEN_CLI_IMAGE_NAME }}:${{ github.ref_name }} \
-t ${{ env.GHCR_CODEGEN_CLI_IMAGE_NAME }} \
-t ${{ env.GHCR_CODEGEN_CLI_IMAGE_NAME }}:latest-release \
./modules/openapi-generator-cli
Loading