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

[HMA] Docker Release GHCR action #1585

Merged
merged 1 commit into from
May 8, 2024
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
56 changes: 56 additions & 0 deletions .github/workflows/hma-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.

name: Publish HMA docker image

on:
push:
branches:
- main
paths:
- "hasher-matcher-actioner/version.txt"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

defaults:
run:
working-directory: hasher-matcher-actioner

jobs:
build-and-push:
name: Build and Publish Docker Image to registry
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Read version and lowercase image name
id: version
run: |
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
echo "IMAGE_NAME_LC=${IMAGE_NAME,,}" >>${GITHUB_ENV}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
context: hasher-matcher-actioner
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}/hma:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}/hma:${{ env.VERSION }}
1 change: 1 addition & 0 deletions hasher-matcher-actioner/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Was debating whether we should use a < 1.0.0 version, do you have an opinion?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was close to do 0.0.1 lol, but also figured you may have a more strong opinion. Considering there seems to be users already with it in prod I think it is on a good state for it to be considered the first release tho.

Loading