Skip to content

Commit

Permalink
Merge pull request #29 from smartbooster/ci_remove_on_pull_request_tr…
Browse files Browse the repository at this point in the history
…igger

Ci remove on pull request trigger
  • Loading branch information
mathieu-ducrot committed Jan 3, 2024
2 parents 7d60139 + 1cf1e51 commit 0af135f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,55 @@
# Inspiration : https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions
name: Create and publish a Docker image

on: [ pull_request, workflow_dispatch ]
# Configures this workflow to run only on demand.
on: [ workflow_dispatch ]

env:
REGISTRY: ghcr.io # Container registry domain
IMAGE_NAME: ${{ github.repository }} # Name for the Docker image
# Container registry domain
REGISTRY: ghcr.io
# Name for the Docker image
IMAGE_NAME: ${{ github.repository }}
NODE_VERSION: 18.17.0

# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
push:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
php_data:
- {php_version: 8.2, push: true}
- {php_version: 8.1, push: false}
permissions: # Sets the permissions granted to the GITHUB_TOKEN for the actions in this job.
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
packages: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry # Uses the docker/login-action action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
# Uses the `docker/login-action` action to log in to the Container registry using the account and password that will publish the packages.
# Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker # This step uses docker/metadata-action to extract tags and labels that will be applied to the specified image. The id "meta" allows the output of this step to be referenced in a subsequent step. The images value provides the base name for the tags and labels.
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied
# to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value
# provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: php${{ matrix.php_data.php_version }}
- name: Build and push Docker image # This step uses the docker/build-push-action action to build the image, based on your repository's Dockerfile. If the build succeeds, it pushes the image to GitHub Packages. It uses the context parameter to define the build's context as the set of files located in the specified path. For more information, see "Usage" in the README of the docker/build-push-action repository. It uses the tags and labels parameters to tag and label the image with the output from the "meta" step.
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds,
# it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information,
# see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
Expand Down
1 change: 1 addition & 0 deletions make/docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ df: docker-fetch ## Alias for docker-fetch
.PHONY: docker-post-fetch
docker-post-fetch: ## Post smartbooster/symfony-docker fetch process to clean unwanted files to be sync
git restore --staged .env.skeleton
rm -rf .github
rm -f .env.skeleton
git restore --staged package.json
git restore package.json
Expand Down

0 comments on commit 0af135f

Please sign in to comment.