From 05dea8beb85e175349c26ee9765a693141b285b2 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 20 May 2022 16:13:46 +0300 Subject: [PATCH 01/11] Add goreleaser and docker publishing Signed-off-by: Andrew Nikitin --- .github/workflows/build.yml | 11 +++++- .github/workflows/dispatch.yml | 23 +++++++++---- .github/workflows/release.yml | 61 ++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f7715c4..ee99031c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,4 +26,13 @@ jobs: - name: Check docker building working-directory: . - run: docker build -f docker/Dockerfile . + run: docker build -f docker/Dockerfile -t cheqd-did-resolver . + + - name: Save cheqd-did-resolver Docker image + run: docker save -o cheqd-did-resolver.tar cheqd-did-resolver + + - name: Store cheqd-did-resolver artifact + uses: actions/upload-artifact@v3 + with: + name: cheqd-did-resolver.tar + path: cheqd-did-resolver.tar diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 11a0c525..50322975 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -7,16 +7,25 @@ concurrency: jobs: - call-lint: - name: "Lint" - uses: ./.github/workflows/lint.yml - +# call-lint: +# name: "Lint" +# uses: ./.github/workflows/lint.yml +# call-build: name: "Build" needs: call-lint uses: ./.github/workflows/build.yml +# +# call-test: +# name: "Tests" +# needs: call-build +# uses: ./.github/workflows/test.yml - call-test: - name: "Tests" + call-release: + name: "Release" +# needs: [call-test, call-build] needs: call-build - uses: ./.github/workflows/test.yml + if: startsWith(github.ref, 'refs/tags/v') + uses: ./.github/workflows/release.yml + with: + RELEASE_VERSION: 1.0.0 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..974298ed --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,61 @@ +name: "Release" +on: + workflow_call: + inputs: + RELEASE_VERSION: + description: "Release version number" + required: true + type: string +defaults: + run: + shell: bash + + +jobs: + go-releaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v2 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + # either 'goreleaser' (default) or 'goreleaser-pro' + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + publish-docker: + name: "Publish Docker images" + runs-on: ubuntu-latest + env: + RELEASE_VERSION: ${{ inputs.VERSION }} + + steps: + - name: Download resolver Docker image + uses: actions/download-artifact@v3 + with: + name: cheqd-did-resolver.tar + + - name: Load resolver Docker image + run: docker load -i cheqd-did-resolver.tar + + - name: Login to Container registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push cheqd-node image + run: | + docker tag cheqd-did-resolver ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} + docker tag cheqd-did-resolver ghcr.io/${{ github.repository }}:latest + docker push ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} + docker push ghcr.io/${{ github.repository }}:latest \ No newline at end of file From 17ec83c5f4ee152908a3b3d12dd356f7390d2389 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 20 May 2022 16:15:08 +0300 Subject: [PATCH 02/11] Debug Signed-off-by: Andrew Nikitin --- .github/workflows/dispatch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 50322975..5293d3a0 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -13,7 +13,7 @@ jobs: # call-build: name: "Build" - needs: call-lint +# needs: call-lint uses: ./.github/workflows/build.yml # # call-test: From edaf509a7c748e5505d69b6873777e4e5b18a30e Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 20 May 2022 16:18:38 +0300 Subject: [PATCH 03/11] Debug Signed-off-by: Andrew Nikitin --- .github/workflows/dispatch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 5293d3a0..9b41c53e 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -25,7 +25,7 @@ jobs: name: "Release" # needs: [call-test, call-build] needs: call-build - if: startsWith(github.ref, 'refs/tags/v') +# if: startsWith(github.ref, 'refs/tags/v') uses: ./.github/workflows/release.yml with: RELEASE_VERSION: 1.0.0 \ No newline at end of file From a9dbf3ed003285efd34d5ec5f37c9984b1321c87 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 20 May 2022 16:23:55 +0300 Subject: [PATCH 04/11] Add registry Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 974298ed..3dd8524a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,6 +36,7 @@ jobs: runs-on: ubuntu-latest env: RELEASE_VERSION: ${{ inputs.VERSION }} + REGISTRY: ghcr.io steps: - name: Download resolver Docker image From 167508128d661bcd558c00f29217bfd743ad5ef2 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 20 May 2022 16:51:55 +0300 Subject: [PATCH 05/11] Add goreleaser config Signed-off-by: Andrew Nikitin --- .github/workflows/dispatch.yml | 2 +- .github/workflows/release.yml | 68 +++++++++++++++++++--------------- .goreleaser.yaml | 13 +++++++ 3 files changed, 52 insertions(+), 31 deletions(-) create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 9b41c53e..e456b735 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -28,4 +28,4 @@ jobs: # if: startsWith(github.ref, 'refs/tags/v') uses: ./.github/workflows/release.yml with: - RELEASE_VERSION: 1.0.0 \ No newline at end of file + RELEASE_VERSION: "1.0.0" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3dd8524a..ba7416ee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,51 +12,59 @@ defaults: jobs: - go-releaser: + make-release: runs-on: ubuntu-latest + env: + RELEASE_VERSION: ${{ inputs.RELEASE_VERSION }} + REGISTRY: ghcr.io steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Set up Go uses: actions/setup-go@v2 + + - name: Login to Container registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: # either 'goreleaser' (default) or 'goreleaser-pro' - distribution: goreleaser - version: latest + version: ${{ env.RELEASE_VERSION }} args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - publish-docker: - name: "Publish Docker images" - runs-on: ubuntu-latest - env: - RELEASE_VERSION: ${{ inputs.VERSION }} - REGISTRY: ghcr.io - - steps: - - name: Download resolver Docker image - uses: actions/download-artifact@v3 - with: - name: cheqd-did-resolver.tar - - - name: Load resolver Docker image - run: docker load -i cheqd-did-resolver.tar +# - name: Download resolver Docker image +# uses: actions/download-artifact@v3 +# with: +# name: cheqd-did-resolver.tar +# +# - name: Load resolver Docker image +# run: docker load -i cheqd-did-resolver.tar +# - - name: Login to Container registry - uses: docker/login-action@v1 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} +# +# - name: Push cheqd-node image +# run: | +# docker tag cheqd-did-resolver ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} +# docker tag cheqd-did-resolver ghcr.io/${{ github.repository }}:latest +# docker push ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} +# docker push ghcr.io/${{ github.repository }}:latest - - name: Push cheqd-node image - run: | - docker tag cheqd-did-resolver ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} - docker tag cheqd-did-resolver ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} - docker push ghcr.io/${{ github.repository }}:latest \ No newline at end of file +# - uses: "marvinpinto/action-automatic-releases@latest" +# with: +# repo_token: "${{ secrets.GITHUB_TOKEN }}" +# automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" +# prerelease: true +# draft: true +# files: | +# +# cheqd-noded \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 00000000..72a0d866 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,13 @@ +project_name: example +builds: + - env: [CGO_ENABLED=0] + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 +dockers: + - image_templates: ["ghcr.io/cheqd/did-resolver:{{ .Version }}"] + dockerfile: docker/Dockerfile \ No newline at end of file From f91d86b611fe5f92442f3f83173169942a24e928 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 20 May 2022 17:13:01 +0300 Subject: [PATCH 06/11] Push docker images Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 32 +++++++++++++++----------------- .goreleaser.yaml | 5 +---- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ba7416ee..2be44496 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,6 +33,21 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Download resolver Docker image + uses: actions/download-artifact@v3 + with: + name: cheqd-did-resolver.tar + + - name: Load resolver Docker image + run: docker load -i cheqd-did-resolver.tar + + - name: Push cheqd-node image + run: | + docker tag cheqd-did-resolver ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} + docker tag cheqd-did-resolver ghcr.io/${{ github.repository }}:latest + docker push ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} + docker push ghcr.io/${{ github.repository }}:latest + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: @@ -42,23 +57,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# - name: Download resolver Docker image -# uses: actions/download-artifact@v3 -# with: -# name: cheqd-did-resolver.tar -# -# - name: Load resolver Docker image -# run: docker load -i cheqd-did-resolver.tar -# - -# -# - name: Push cheqd-node image -# run: | -# docker tag cheqd-did-resolver ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} -# docker tag cheqd-did-resolver ghcr.io/${{ github.repository }}:latest -# docker push ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} -# docker push ghcr.io/${{ github.repository }}:latest - # - uses: "marvinpinto/action-automatic-releases@latest" # with: # repo_token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 72a0d866..b597b284 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -7,7 +7,4 @@ builds: - darwin goarch: - amd64 - - arm64 -dockers: - - image_templates: ["ghcr.io/cheqd/did-resolver:{{ .Version }}"] - dockerfile: docker/Dockerfile \ No newline at end of file + - arm64 \ No newline at end of file From 5338b06a08cc10cc879bc86b50de24fd686cb41d Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 20 May 2022 17:26:37 +0300 Subject: [PATCH 07/11] Make release possible Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 8 +++++++- .goreleaser.yaml | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2be44496..991aeb9f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,11 +52,17 @@ jobs: uses: goreleaser/goreleaser-action@v2 with: # either 'goreleaser' (default) or 'goreleaser-pro' - version: ${{ env.RELEASE_VERSION }} + version: latest args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload assets + uses: actions/upload-artifact@v2 + with: + name: did-resolver + path: dist/* + # - uses: "marvinpinto/action-automatic-releases@latest" # with: # repo_token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.goreleaser.yaml b/.goreleaser.yaml index b597b284..ea6e14f7 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,4 +1,5 @@ -project_name: example +release: + prerelease: "true" builds: - env: [CGO_ENABLED=0] goos: From 9b8e6ad0130e56a3de12b2165859786cf4e056ab Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 20 May 2022 17:28:02 +0300 Subject: [PATCH 08/11] Debug Signed-off-by: Andrew Nikitin --- .github/workflows/dispatch.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index e456b735..7c83ccef 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -25,7 +25,7 @@ jobs: name: "Release" # needs: [call-test, call-build] needs: call-build -# if: startsWith(github.ref, 'refs/tags/v') + if: startsWith(github.ref, 'refs/tags/v') uses: ./.github/workflows/release.yml with: - RELEASE_VERSION: "1.0.0" \ No newline at end of file + RELEASE_VERSION: ${GITHUB_REF_NAME} \ No newline at end of file From fcd22a8f16c14ccbec7e636a75aa10282dd82d58 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 20 May 2022 17:33:16 +0300 Subject: [PATCH 09/11] Debug Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 991aeb9f..77161b78 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,7 +39,9 @@ jobs: name: cheqd-did-resolver.tar - name: Load resolver Docker image - run: docker load -i cheqd-did-resolver.tar + run: | + docker load -i cheqd-did-resolver.tar + rm cheqd-did-resolver.tar - name: Push cheqd-node image run: | From bee96127a5131a37ee227a3550165033bb8f590d Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 20 May 2022 17:34:53 +0300 Subject: [PATCH 10/11] Debug Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 77161b78..c87ff637 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,8 +40,8 @@ jobs: - name: Load resolver Docker image run: | - docker load -i cheqd-did-resolver.tar - rm cheqd-did-resolver.tar + docker load -i cheqd-did-resolver.tar + rm cheqd-did-resolver.tar - name: Push cheqd-node image run: | From 46dfcced0172939057fa85c6b40dbe76fed85622 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 20 May 2022 18:40:09 +0300 Subject: [PATCH 11/11] Make PR ready Signed-off-by: Andrew Nikitin --- .github/workflows/dispatch.yml | 23 +++++++++++------------ .github/workflows/release.yml | 12 +----------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 7c83ccef..f9c13bd2 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -7,24 +7,23 @@ concurrency: jobs: -# call-lint: -# name: "Lint" -# uses: ./.github/workflows/lint.yml -# + call-lint: + name: "Lint" + uses: ./.github/workflows/lint.yml + call-build: name: "Build" -# needs: call-lint + needs: call-lint uses: ./.github/workflows/build.yml -# -# call-test: -# name: "Tests" -# needs: call-build -# uses: ./.github/workflows/test.yml + + call-test: + name: "Tests" + needs: call-build + uses: ./.github/workflows/test.yml call-release: name: "Release" -# needs: [call-test, call-build] - needs: call-build + needs: [call-test, call-build] if: startsWith(github.ref, 'refs/tags/v') uses: ./.github/workflows/release.yml with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c87ff637..d57000a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,14 +63,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: did-resolver - path: dist/* - -# - uses: "marvinpinto/action-automatic-releases@latest" -# with: -# repo_token: "${{ secrets.GITHUB_TOKEN }}" -# automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" -# prerelease: true -# draft: true -# files: | -# -# cheqd-noded \ No newline at end of file + path: dist/* \ No newline at end of file