From c4a0d541daa4b7b72b330aa13833478a0104c07a Mon Sep 17 00:00:00 2001 From: Dakota Howard <58985143+dthoward96@users.noreply.github.com> Date: Wed, 25 Sep 2024 18:26:16 -0400 Subject: [PATCH] GitHub action test (#83) * Create DH_upload.yml * Update DH_upload.yml * Update DH_upload.yml * Update DH_upload.yml * Update DH_upload.yml * Update DH_upload.yml * Update DH_upload.yml * Update DH_upload.yml * Update DH_upload.yml * Update DH_upload.yml * Update DH_upload.yml * Update DH_upload.yml * Update and rename DH_upload.yml to DH_GHCR_upload.yml * Update DH_GHCR_upload.yml * Delete .github/workflows/GHCR_docker.yml * Update DH_GHCR_upload.yml --- .github/workflows/DH_GHCR_upload.yml | 52 ++++++++++++++++++++++++++++ .github/workflows/GHCR_docker.yml | 42 ---------------------- 2 files changed, 52 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/DH_GHCR_upload.yml delete mode 100644 .github/workflows/GHCR_docker.yml diff --git a/.github/workflows/DH_GHCR_upload.yml b/.github/workflows/DH_GHCR_upload.yml new file mode 100644 index 00000000..8a3d0151 --- /dev/null +++ b/.github/workflows/DH_GHCR_upload.yml @@ -0,0 +1,52 @@ +name: Create and publish docker image to DockerHub and GitHub Container Repository + +on: + release: + types: [published] + +jobs: + push_to_registry: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + attestations: write + id-token: write + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log into GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: | + cdcgov/seqsender + ghcr.io/${{ github.repository }} + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + tags: | + cdcgov/seqsender:${{ github.ref_name }} + cdcgov/seqsender:latest + ghcr.io/cdcgov/seqsender:${{ github.ref_name }} + ghcr.io/cdcgov/seqsender:latest + labels: "Genomic sequence pipeline to automate the process of generating necessary submission files and batch uploading them to public databases." diff --git a/.github/workflows/GHCR_docker.yml b/.github/workflows/GHCR_docker.yml deleted file mode 100644 index bedf2ec4..00000000 --- a/.github/workflows/GHCR_docker.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Create and publish docker image to GHCR - -on: - push: - branches: [ "master" ] - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Log into container registry - uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: type=ref,event=branch - - - name: Build and push Docker image - uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }}