Merge pull request #23 from Automattic/team_sync #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create and publish docker image to GitHub Container Registry | |
on: | |
workflow_dispatch: | |
push: | |
branches: ['develop'] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: "" | |
jobs: | |
call-run-tests: | |
uses: ./.github/workflows/run-tests.yml | |
build-and-push-image: | |
needs: call-run-tests | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Lowercase IMAGE_NAME | |
run: | | |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
labels: ${{ steps.meta.outputs.labels }} |