Repository navigation
chore(ci): publish the image to ghcr.io, and drop the unused action wrapper [FTTECH-15150] #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cf5cb1d
chore(ci): publish the image to ghcr.io, and drop the unused action w…
florentsorel f171a90
chore(ci): remove the Asana workflow
florentsorel 01ddc89
chore(gha): update mobsuccess.yml and closed.yml to the policy's curr…
florentsorel f1f59dd
chore(ci): keep the Asana workflow, its check is required on master
florentsorel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| README.md | ||
| examples | ||
| * | ||
| !entrypoint.sh | ||
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| name: Docker | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| paths: | ||
| - "Dockerfile" | ||
| - "entrypoint.sh" | ||
| - ".github/workflows/docker.yml" | ||
| push: | ||
| branches: [master] | ||
| paths: | ||
| - "Dockerfile" | ||
| - "entrypoint.sh" | ||
| - ".github/workflows/docker.yml" | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
| IMAGE_NAME: ${{ github.repository }} | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build Docker image | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v7 | ||
|
|
||
| - name: PHP-CS-Fixer version | ||
| id: version | ||
| run: echo "version=$(sed -n 's/^ARG PHP_CS_FIXER_VERSION=//p' Dockerfile)" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Log in to Container Registry | ||
| if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' | ||
| uses: docker/login-action@v4 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Docker metadata | ||
| id: meta | ||
| uses: docker/metadata-action@v6 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
| tags: | | ||
| type=raw,value=v${{ steps.version.outputs.version }},enable={{is_default_branch}} | ||
| type=sha,format=long | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v4 | ||
|
|
||
| - name: Build and push | ||
| uses: docker/build-push-action@v7 | ||
| with: | ||
| context: . | ||
| platforms: linux/amd64 | ||
| push: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max |
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,12 @@ | ||
| FROM --platform=linux/amd64 php:8.1-alpine | ||
| FROM php:8.1.34-alpine | ||
|
florentsorel marked this conversation as resolved.
Resolved
|
||
|
|
||
| LABEL "com.github.actions.name"="PHP-CS-Fixer" | ||
| LABEL "com.github.actions.description"="check php files" | ||
| LABEL "com.github.actions.icon"="check" | ||
| LABEL "com.github.actions.color"="blue" | ||
| ARG PHP_CS_FIXER_VERSION=3.13.0 | ||
| ARG PHP_CS_FIXER_SHA256=ac2e57e32cdae67f21baa88f78405f93d4d6e928f41ba62dc91505565c785a44 | ||
|
|
||
| RUN wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.13.0/php-cs-fixer.phar -O php-cs-fixer \ | ||
| && chmod a+x php-cs-fixer \ | ||
| && mv php-cs-fixer /usr/local/bin/php-cs-fixer | ||
| ADD --checksum=sha256:${PHP_CS_FIXER_SHA256} --chmod=755 \ | ||
| https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v${PHP_CS_FIXER_VERSION}/php-cs-fixer.phar \ | ||
| /usr/local/bin/php-cs-fixer | ||
|
|
||
| COPY entrypoint.sh /entrypoint.sh | ||
|
|
||
| ADD entrypoint.sh /entrypoint.sh | ||
| ENTRYPOINT ["/entrypoint.sh"] | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1,46 @@ | ||
| # GithubAction for PHP-CS-Fixer | ||
| # github-actions-php-cs-fixer | ||
|
|
||
| ## Usage | ||
| A Docker image that runs [PHP-CS-Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) | ||
| in a GitHub Actions workflow. Its arguments are passed to `php-cs-fixer fix`. | ||
|
|
||
| You can use it as a Github Action like this: | ||
| ## Usage | ||
|
|
||
| _.github/workflows/lint.yml_ | ||
| ```yaml | ||
| on: [push, pull_request] | ||
| name: Main | ||
| jobs: | ||
| php-cs-fixer: | ||
| name: PHP-CS-Fixer | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: PHP-CS-Fixer | ||
| uses: docker://oskarstark/php-cs-fixer-ga | ||
| - uses: actions/checkout@v7 | ||
| - name: PHP-CS-Fixer | ||
| uses: docker://ghcr.io/mobsuccess-devops/github-actions-php-cs-fixer:v3.13.0 | ||
| with: | ||
| args: --config=.php-cs-fixer.dist.php --diff --dry-run . | ||
| ``` | ||
|
|
||
| _to use a custom config for example, --diff and --dry-run option:_ | ||
| ```diff | ||
| on: [push, pull_request] | ||
| name: Main | ||
| jobs: | ||
| php-cs-fixer: | ||
| name: PHP-CS-Fixer | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: PHP-CS-Fixer | ||
| uses: docker://oskarstark/php-cs-fixer-ga | ||
| + with: | ||
| + args: --config=.project.php_cs --diff --dry-run | ||
| ``` | ||
| The tag is the PHP-CS-Fixer version. Keep it in the workflow: another version | ||
| has other rules, and would reformat the code it checks. | ||
|
|
||
| **You can copy/paste the .github folder (under examples/) to your project and thats all!** | ||
| Locally, from the repository to check: | ||
|
|
||
| ## Docker | ||
| ```bash | ||
| docker run --rm -v "$PWD:/app" -w /app ghcr.io/mobsuccess-devops/github-actions-php-cs-fixer:v3.13.0 --diff --dry-run . | ||
| ``` | ||
|
|
||
| A Docker-Image is built automatically and located here: | ||
| https://hub.docker.com/r/oskarstark/php-cs-fixer-ga | ||
| ## Image | ||
|
|
||
| You can run it in any given directory like this: | ||
| A push to `master` that changes the `Dockerfile` or `entrypoint.sh` publishes | ||
| the image to `ghcr.io/mobsuccess-devops/github-actions-php-cs-fixer` | ||
| (`.github/workflows/docker.yml`), tagged with the PHP-CS-Fixer version. The | ||
| `Docker` workflow can also be run by hand. | ||
|
|
||
| `docker run --rm -it -w=/app -v ${PWD}:/app oskarstark/php-cs-fixer-ga:latest` | ||
| Workflows pull it without credentials, so the package has to be public: keep | ||
| secrets out of the image. A package is private when first published; someone | ||
| with admin rights on it makes it public once (Package settings → Danger Zone → | ||
| Change visibility), which cannot be undone. | ||
|
|
||
| ## A picture is worth a thousand words | ||
| To move to another PHP-CS-Fixer version, change `PHP_CS_FIXER_VERSION` and | ||
| `PHP_CS_FIXER_SHA256` in the `Dockerfile` (the SHA-256 of the released | ||
| `php-cs-fixer.phar`), and the tag in `compose.yml` and in this file. | ||
|
|
||
| You can find a working and not working PR here: | ||
| https://github.com/OskarStark/test-php-cs-fixer-ga/pulls | ||
| To build the image locally: `docker compose build`. |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| services: | ||
| php-cs-fixer: | ||
| build: . | ||
| image: ghcr.io/mobsuccess-devops/github-actions-php-cs-fixer:v3.13.0 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.