From 0a164aa8b0e93aec667600214280ae9581e29d86 Mon Sep 17 00:00:00 2001 From: Ferror Date: Mon, 3 Jul 2023 22:28:18 +0200 Subject: [PATCH 1/5] feat: build and publish docker image for arm and amd platforms --- .github/workflows/release-docker.yml | 41 ++++++++++++++++++---------- Dockerfile | 4 ++- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 02651069d..3fc0385eb 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -1,7 +1,7 @@ name: Release Docker Image -on: +on: release: - types: + types: - published jobs: @@ -10,24 +10,35 @@ jobs: name: Docker build and push runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: master - name: Get version without v character id: version run: | VERSION=${{github.event.release.tag_name}} VERSION_WITHOUT_V=${VERSION:1} - echo "::set-output name=value::$(echo $VERSION_WITHOUT_V)" - - name: Release to Docker - run: | - echo ${{secrets.DOCKER_PASSWORD}} | docker login -u ${{secrets.DOCKER_USERNAME}} --password-stdin - sleep 1m #docker image installs generator from npm, this sleep protects this step from any delays on npm side - npm run docker:build - docker tag asyncapi/generator:latest asyncapi/generator:${{ steps.version.outputs.value }} - docker push asyncapi/generator:${{ steps.version.outputs.value }} - docker push asyncapi/generator:latest + echo "value=${VERSION_WITHOUT_V}" >> $GITHUB_OUTPUT + + - name: Set Up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set Up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build Image + uses: docker/build-push-action@v4 + with: + push: true + load: false + build-args: | + ASYNCAPI_GENERATOR_VERSION=${{ steps.version.outputs.value }} + tags: | + asyncapi/generator:${{ steps.version.outputs.value }} + asyncapi/generator:latest + platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha diff --git a/Dockerfile b/Dockerfile index e6bd013fa..43dcba93b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +ARG ASYNCAPI_GENERATOR_VERSION=0.50.0 + FROM node:14-alpine WORKDIR /app @@ -14,6 +16,6 @@ RUN apk --update add git chromium && \ rm /var/cache/apk/* # Installing latest released npm package -RUN npm install -g @asyncapi/generator +RUN npm install -g @asyncapi/generator@$ASYNCAPI_GENERATOR_VERSION ENTRYPOINT [ "ag" ] From 19d722862824f1130aee177f7f196bb5f2caf113 Mon Sep 17 00:00:00 2001 From: Zbigniew Malcherczyk Date: Tue, 4 Jul 2023 09:52:20 +0200 Subject: [PATCH 2/5] Update release-docker.yml --- .github/workflows/release-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 3fc0385eb..267e4696b 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -26,7 +26,7 @@ jobs: - name: login to Docker Hub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} + username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build Image From 90d02e1945d14873aaf02cd07d0301f1bc87ec7e Mon Sep 17 00:00:00 2001 From: Zbigniew Malcherczyk Date: Tue, 4 Jul 2023 18:18:29 +0200 Subject: [PATCH 3/5] change argument default version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 43dcba93b..6ca463966 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG ASYNCAPI_GENERATOR_VERSION=0.50.0 +ARG ASYNCAPI_GENERATOR_VERSION=1.10.9 FROM node:14-alpine From dc099f56f7dd48ed8cee84ab7e1587a725a93c5c Mon Sep 17 00:00:00 2001 From: Zbigniew Malcherczyk Date: Fri, 6 Oct 2023 20:29:09 +0200 Subject: [PATCH 4/5] sleep 1s --- .github/workflows/release-docker.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 267e4696b..55344cc76 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -29,6 +29,10 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + # This workflow triggers on GitHub Release, but it may start before the npm package is published. + - name: Sleep for 1s seconds + run: sleep 1s + - name: Build Image uses: docker/build-push-action@v4 with: From 821895f3d13326581ffa47a61948ced7bd439ef7 Mon Sep 17 00:00:00 2001 From: Zbigniew Malcherczyk Date: Mon, 9 Oct 2023 23:46:48 +0200 Subject: [PATCH 5/5] sync readme --- .github/workflows/release-docker.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 55344cc76..0439ed126 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -46,3 +46,11 @@ jobs: platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha + + - name: Update Docker Hub Readme + uses: meeDamian/sync-readme@v1.0.6 + with: + user: ${{ secrets.DOCKER_USERNAME }} + pass: ${{ secrets.DOCKER_PASSWORD }} + slug: asyncapi/generator + description: Use your AsyncAPI definition to generate literally anything. Markdown documentation, Node.js code, HTML documentation, anything!