From bce8e44f4c748d849b2a93edbf8c3f733d9881a9 Mon Sep 17 00:00:00 2001 From: Sawyer Date: Sat, 12 Oct 2024 16:07:11 -0400 Subject: [PATCH] updated build actions --- .../{build_image.yml => build_api_image.yml} | 4 +- .github/workflows/build_ids_image.yml | 55 +++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) rename .github/workflows/{build_image.yml => build_api_image.yml} (94%) create mode 100644 .github/workflows/build_ids_image.yml diff --git a/.github/workflows/build_image.yml b/.github/workflows/build_api_image.yml similarity index 94% rename from .github/workflows/build_image.yml rename to .github/workflows/build_api_image.yml index a5d430e..fdd7bac 100644 --- a/.github/workflows/build_image.yml +++ b/.github/workflows/build_api_image.yml @@ -5,13 +5,13 @@ on: branches: - main paths: - - ".github/workflows/build_image.yml" + - ".github/workflows/build_api_image.yml" - "ml-api/**" pull_request: branches: - main paths: - - ".github/workflows/build_image.yml" + - ".github/workflows/build_api_image.yml" - "ml-api/**" # these path settings ensure this workflow only executes on a push # to this YML itself, or any file in the ml-api folder diff --git a/.github/workflows/build_ids_image.yml b/.github/workflows/build_ids_image.yml new file mode 100644 index 0000000..3f381f4 --- /dev/null +++ b/.github/workflows/build_ids_image.yml @@ -0,0 +1,55 @@ +name: Build get_project_ids Docker Image + +on: + push: + branches: + - main + paths: + - ".github/workflows/build_ids_image.yml" + - "gef-portal-scraper/get_project_ids.py" + pull_request: + branches: + - main + paths: + - ".github/workflows/build_ids_image.yml" + - "gef-portal-scraper/get_project_ids.py" + # these path settings ensure this workflow only executes on a push + # to this YML itself, or any file in the ml-api folder + +jobs: + build_and_push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Check out the repository + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + # note: you don't need to setup this token -- GH does it for you + + # this step converts your GH username to lowercase if needed (required for ghcr) + # and sets the correct environment variable + - name: Define lowercase repository owner + id: repo + run: echo "REPO_OWNER_LC=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + # this sets the build context to the ml-api folder. It will by default + # build from whatever Dockerfile it finds here + context: ./gef-portal-scraper + file: Dockerfile.get_project_ids + push: true + tags: ghcr.io/${{ env.REPO_OWNER_LC }}/get_project_ids:latest