From d4e1d9084e54e2b83485688e29a0030bc01cdf69 Mon Sep 17 00:00:00 2001 From: Ferror Date: Mon, 3 Jul 2023 19:20:17 +0200 Subject: [PATCH 01/10] chore: improve docker release pipeline --- .github/workflows/release-docker.yml | 49 +++++++++++++++++++--------- Dockerfile | 6 ++-- 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 24c62b9c7c4..a74dddaac96 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -1,16 +1,15 @@ name: Release Docker Image -on: +on: release: - types: + types: - published + jobs: publish-docker: name: Generating Docker runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v3 - name: Get version without v character id: version run: | @@ -18,20 +17,38 @@ jobs: VERSION_WITHOUT_V=${VERSION:1} echo "value=${VERSION_WITHOUT_V}" >> $GITHUB_OUTPUT - - name: Release to Docker - run: | - echo ${{secrets.DOCKER_PASSWORD}} | docker login -u ${{secrets.DOCKER_USERNAME}} --password-stdin - npm run docker:build - docker tag asyncapi/cli:latest asyncapi/cli:${{ steps.version.outputs.value }} - docker push asyncapi/cli:${{ steps.version.outputs.value }} - docker push asyncapi/cli:latest - - - name : Sync README.md and Description to Docker Hub - uses: actions/checkout@master - + - 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_CLI_VERSION=${{ steps.version.outputs.value }} + tags: | + asyncapi/cli:${{ steps.version.outputs.value }} + asyncapi/cli:latest + platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha + + - name: Checkout repository + uses: actions/checkout@v3 + - uses: meeDamian/sync-readme@v1.0.6 with: - user: ${{secrets.DOCKER_USERNAME}} + user: ${{ secrets.DOCKER_USERNAME }} pass: ${{ secrets.DOCKER_PASSWORD }} slug: asyncapi/cli description: CLI to work with your AsyncAPI files diff --git a/Dockerfile b/Dockerfile index 1e1ad3adc07..aa85ca66935 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +ARG ASYNCAPI_CLI_VERSION=0.50.0 + FROM node:16-alpine # Create a non-root user @@ -16,9 +18,9 @@ RUN apk --update add git chromium && \ rm /var/cache/apk/* # Installing latest released npm package -RUN npm install --ignore-scripts -g @asyncapi/cli +RUN npm install --ignore-scripts -g @asyncapi/cli@$ASYNCAPI_CLI_VERSION # Switch to the non-root user USER myuser -ENTRYPOINT [ "asyncapi" ] \ No newline at end of file +ENTRYPOINT [ "asyncapi" ] From 422315cf792c5ee23f5c7de2f0369fc2859ebde7 Mon Sep 17 00:00:00 2001 From: Zbigniew Malcherczyk Date: Tue, 4 Jul 2023 09:51:59 +0200 Subject: [PATCH 02/10] DOCKER_USERNAME --- .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 a74dddaac96..4895930cdc7 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 59f493573825ba8f7a44fa43fafc7d7c6a8920a8 Mon Sep 17 00:00:00 2001 From: Ferror Date: Thu, 20 Jul 2023 23:52:55 +0200 Subject: [PATCH 03/10] workflow call --- .github/workflows/release-docker.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 4895930cdc7..15fd60bcad4 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -1,8 +1,10 @@ name: Release Docker Image on: - release: - types: - - published + workflow_call: + inputs: + release: + required: true + type: string jobs: @@ -13,7 +15,7 @@ jobs: - name: Get version without v character id: version run: | - VERSION=${{github.event.release.tag_name}} + VERSION=${{ inputs.release }} VERSION_WITHOUT_V=${VERSION:1} echo "value=${VERSION_WITHOUT_V}" >> $GITHUB_OUTPUT From 5b440ca8e33174f07db3441948d9c6232e4c1eb8 Mon Sep 17 00:00:00 2001 From: Zbigniew Malcherczyk Date: Sun, 5 Nov 2023 21:08:13 +0100 Subject: [PATCH 04/10] Update release-docker.yml --- .github/workflows/release-docker.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 15fd60bcad4..5e215fd3a96 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -1,10 +1,8 @@ name: Release Docker Image on: - workflow_call: - inputs: - release: - required: true - type: string + release: + types: + - published jobs: @@ -15,7 +13,7 @@ jobs: - name: Get version without v character id: version run: | - VERSION=${{ inputs.release }} + VERSION=${{ github.event.release.tag_name }} VERSION_WITHOUT_V=${VERSION:1} echo "value=${VERSION_WITHOUT_V}" >> $GITHUB_OUTPUT @@ -31,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 423a6cdc501f3e5023eaa532dabe9c5dfb97f545 Mon Sep 17 00:00:00 2001 From: Zbigniew Malcherczyk Date: Sun, 5 Nov 2023 21:09:22 +0100 Subject: [PATCH 05/10] Update release-docker.yml --- .github/workflows/release-docker.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 5e215fd3a96..d3e19802758 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -47,9 +47,6 @@ jobs: cache-from: type=gha cache-to: type=gha - - name: Checkout repository - uses: actions/checkout@v3 - - uses: meeDamian/sync-readme@v1.0.6 with: user: ${{ secrets.DOCKER_USERNAME }} From bab136679a3a940f22a218ab9ec58132eae115d5 Mon Sep 17 00:00:00 2001 From: Zbigniew Malcherczyk Date: Sun, 5 Nov 2023 21:10:21 +0100 Subject: [PATCH 06/10] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index aa85ca66935..c11aac9bfa3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG ASYNCAPI_CLI_VERSION=0.50.0 +ARG ASYNCAPI_CLI_VERSION=0.59.1 FROM node:16-alpine From 32f780a7475f833b761992d1619f12e7bffa11b9 Mon Sep 17 00:00:00 2001 From: Zbigniew Malcherczyk Date: Sun, 5 Nov 2023 21:12:14 +0100 Subject: [PATCH 07/10] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c11aac9bfa3..e5d97f653ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -ARG ASYNCAPI_CLI_VERSION=0.59.1 - FROM node:16-alpine +ARG ASYNCAPI_CLI_VERSION=0.59.1 + # Create a non-root user RUN addgroup -S myuser && adduser -S myuser -G myuser From 154bfbd7341b417d1119122a82df53ee3a7d996a Mon Sep 17 00:00:00 2001 From: Zbigniew Malcherczyk Date: Tue, 7 Nov 2023 18:33:22 +0100 Subject: [PATCH 08/10] Update release-docker.yml --- .github/workflows/release-docker.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index d3e19802758..7b964e7b238 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -47,6 +47,9 @@ jobs: cache-from: type=gha cache-to: type=gha + - name: Sync README.md and Description to Docker Hub + uses: actions/checkout@v4.1.1 + - uses: meeDamian/sync-readme@v1.0.6 with: user: ${{ secrets.DOCKER_USERNAME }} From 97764e0b5b9ae3e40f22aca43f6df519e208c321 Mon Sep 17 00:00:00 2001 From: Zbigniew Malcherczyk Date: Thu, 16 Nov 2023 21:15:03 +0100 Subject: [PATCH 09/10] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e5d97f653ee..1e20d6aa50e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ RUN apk --update add git chromium && \ rm /var/cache/apk/* # Installing latest released npm package -RUN npm install --ignore-scripts -g @asyncapi/cli@$ASYNCAPI_CLI_VERSION +RUN npm install --ignore-scripts -g @asyncapi/cli@"$ASYNCAPI_CLI_VERSION" # Switch to the non-root user USER myuser From 00514ce1edc828b9d63cdc8754dd9d8363b4423b Mon Sep 17 00:00:00 2001 From: Lukasz Gornicki Date: Mon, 18 Dec 2023 11:11:17 +0100 Subject: [PATCH 10/10] Update release-docker.yml --- .github/workflows/release-docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 7b964e7b238..21790e4bfb8 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -30,8 +30,8 @@ jobs: 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: Sleep for 30 sec + run: sleep 30s - name: Build Image uses: docker/build-push-action@v4