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: fix docker tags #375

Merged
merged 3 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
23 changes: 12 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ on:
push:
branches:
- main

tags:
- 'v*'
name: Build docker image
jobs:
build-docker:
Expand All @@ -13,17 +14,19 @@ jobs:

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

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

Comment on lines -16 to -20
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for this, docker/metadata-action has support to configure tags

- id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/obolnetwork/charon/charon
tags: "latest,${{steps.get-version.outputs.version}}"
images: ghcr.io/obolnetwork/charon/charon
tags: |
# Tag "git short sha" on push to branch (main)
type=sha,event=branch

# Tag "latest" on all events
type=raw,value=latest

# Tag "tag ref" on tag push events
type=ref,event=tag

- uses: docker/login-action@v1
with:
Expand All @@ -38,5 +41,3 @@ jobs:
push: true
build-args: GITHUB_SHA=${{ github.sha }}
tags: ${{ steps.meta.outputs.tags }}

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

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

- id: get-tag
run: |
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:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CONTAINER_REGISTRY_SECRET }}

- uses: docker/build-push-action@v2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will not push at the time of release then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still do

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR adds tags: ['v*'] to build.yml which triggers it on release

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update this too since, there is no get-tag step.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed it


- run: cat cli-reference.txt
Expand Down