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

Conversation

corverroos
Copy link
Contributor

Fixes "build" github action to:

  • Push "latest" tag on commits to main.
  • Push "git short sha" tag on commits to main.
  • Push "git tag" tag on tag pushes

category: bug
ticket: #339

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

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

images: ghcr.io/obolnetwork/charon/charon
tags: |
# Tag "git short sha" on push to branch (main)
type=sha,event=branch,format=short
Copy link
Contributor

@dB2510 dB2510 Apr 6, 2022

Choose a reason for hiding this comment

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

can ommit format since it is short by default short

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

type=sha,event=branch,format=short

# Tag "latest" on push to branch (main)
type=raw,event=branch,value=latest
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't need this as line: 29 handle latest tag by default.
ref: https://github.com/docker/metadata-action#latest-tag

Copy link
Contributor

Choose a reason for hiding this comment

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

clarified!

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

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

Copy link
Contributor

@dB2510 dB2510 left a comment

Choose a reason for hiding this comment

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

LGTM

@corverroos corverroos added the merge when ready Indicates bulldozer bot may merge when all checks pass label Apr 6, 2022
@obol-bulldozer obol-bulldozer bot merged commit 5e7e3e1 into main Apr 6, 2022
@obol-bulldozer obol-bulldozer bot deleted the corver/builddocker branch April 6, 2022 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge when ready Indicates bulldozer bot may merge when all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants