Skip to content

Commit

Permalink
Add goreleaser and docker publishing
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Nikitin <andrew.nikitin@cheqd.io>
  • Loading branch information
Andrew Nikitin committed May 20, 2022
1 parent 7940d96 commit 05dea8b
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 8 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 16 additions & 7 deletions .github/workflows/dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 05dea8b

Please sign in to comment.