Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github/workflows: add multi platform docker image #348

Merged
merged 7 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
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
32 changes: 20 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,34 @@ jobs:
runs-on: ubuntu-latest
name: Build Docker Image
steps:

- uses: actions/checkout@v2

- uses: docker/setup-buildx-action@v1

- id: get-version
run: |
version=$(echo "${{ github.sha }}" | cut -c1-8)
echo "::set-output name=version::$version"

- name: Publish to registry
uses: elgohr/Publish-Docker-Github-Action@3.04
env:
NODE_ENV: production
DOCKER_BUILDKIT: 1
- id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/obolnetwork/charon/charon
tags: "latest,${{steps.get-version.outputs.version}}"

- uses: docker/login-action@v1
with:
name: ${{ github.repository }}/charon
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CONTAINER_REGISTRY_SECRET }}
buildargs: GITHUB_SHA=${{ github.sha }}
registry: ghcr.io
tags: "latest,${{steps.get-version.outputs.version}}"

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: GITHUB_SHA=${{ github.sha }}
tags: ${{ steps.meta.outputs.tags }}

- run: echo ${{ steps.docker_build.outputs.digest }}
47 changes: 27 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,45 @@ jobs:
steps:
- uses: actions/checkout@v2

- id: get-version
- uses: docker/setup-buildx-action@v1

- id: get-tag
run: |
version=$(echo "${{ github.ref }}" | cut -d / -f 3)
echo "::set-output name=version::$version"

- name: Publish to registry
uses: elgohr/Publish-Docker-Github-Action@3.02
env:
NODE_ENV: production
DOCKER_BUILDKIT: 1
tag=$(echo "${{ github.ref }}" | cut -d / -f 3)
echo "::set-output name=tag::$tag"

- id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/obolnetwork/charon/charon
tags: "${{steps.get-tag.outputs.tag}}"

- uses: docker/login-action@v1
with:
name: ${{ github.repository }}/charon
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CONTAINER_REGISTRY_SECRET }}
buildargs: GITHUB_SHA=${{ github.sha }}
registry: ghcr.io
tags: "${{ steps.get-version.outputs.version }}"

- name: Generate cli reference
run: docker run ghcr.io/obolnetwork/charon/charon:${{steps.get-version.outputs.version}} charon run --help > cli-reference.txt
- uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: GITHUB_SHA=${{ github.sha }}
tags: ${{ steps.meta.outputs.tags }}

- run: docker run ghcr.io/obolnetwork/charon/charon:${{steps.get-tag.outputs.tag}} charon run --help > cli-reference.txt

- name: View cli reference
run: cat cli-reference.txt
- run: cat cli-reference.txt

- name: Release
uses: softprops/action-gh-release@v1
- uses: softprops/action-gh-release@v1
with:
files: cli-reference.txt
body: |
![Obol Logo](https://obol.tech/obolnetwork.png)

Charon client version `${{steps.get-version.outputs.version}}`.
Charon client version `${{steps.get-tag.outputs.tag}}`.

###### This software is in beta, use with caution
token: ${{ secrets.RELEASE_SECRET }}