Skip to content

Commit

Permalink
Merge pull request #99 from umccr/update/github-actions-docker-build
Browse files Browse the repository at this point in the history
  • Loading branch information
alexiswl authored May 23, 2023
2 parents 167b468 + 84749ae commit c697544
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/build_and_push_container_to_ghcrio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ jobs:
fi
# Output the tag name
echo "::set-output name=tag_name::${tag_name}"
echo "tag_name=${tag_name}" >> "${GITHUB_OUTPUT}"
# Get repository name in lower
- name: get lowercase repo name
id: get_lowercase_repo_name
run: echo "::set-output name=repo_name::$(tr '[:upper:]' '[:lower:]' <<< "${{ github.repository }}")"
run: echo "repo_name=$(tr '[:upper:]' '[:lower:]' <<< "${{ github.repository }}")" >> "${GITHUB_OUTPUT}"
# Set platforms
- name: Set platforms
id: set_platforms
run: echo '::set-output name=platforms::["linux/amd64"]'
run: echo 'platforms=["linux/amd64"]' >> "${GITHUB_OUTPUT}"
outputs:
tag_name: ${{ steps.get_tag_name.outputs.tag_name }}
repo_name: ${{ steps.get_lowercase_repo_name.outputs.repo_name }}
Expand All @@ -63,13 +63,13 @@ jobs:
# Platform to tag suffix
- name: Platform to tag suffix
id: platform_to_tag_suffix
run: echo "::set-output name=platform_tag::$( echo ${{ matrix.platform }} | tr '/' '-' )"
run: echo "platform_tag=$( echo ${{ matrix.platform }} | tr '/' '-' )" >> "${GITHUB_OUTPUT}"
# Use qemu to perform multiplatform builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
# Use docker buildx to build multi-platform containers
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
with:
use: true
install: true
Expand All @@ -78,18 +78,19 @@ jobs:
max-parallelism = 2
# Log in to GitHub Container registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Build and push docker images
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
file: envm/Dockerfile
platforms: ${{ matrix.platform }}
provenance: false
push: true
tags: ghcr.io/${{ needs.get_parameters.outputs.repo_name }}:${{ needs.get_parameters.outputs.tag_name }}-${{ steps.platform_to_tag_suffix.outputs.platform_tag }}

Expand All @@ -103,7 +104,7 @@ jobs:
uses: actions/checkout@v3
# Log in to GitHub Container registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand Down Expand Up @@ -165,7 +166,7 @@ jobs:
< "${GITHUB_EVENT_PATH}" \
)"
# Set output
echo "::set-output name=branch_name::${ref%refs/heads/}"
echo "branch_name=${ref%refs/heads/}" >> "${GITHUB_OUTPUT}"
# Not so standard checkout step
# Need to checkout PR
- name: Checkout code
Expand Down

0 comments on commit c697544

Please sign in to comment.