From afd74f2b4982c7a4bfc469305a23eb22ca9ec1bc Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 22 May 2024 21:37:45 +0300 Subject: [PATCH] initial --- .dockerignore | 0 .editorconfig | 20 ++++++++++++++++++++ .env.ci | 1 + .env.example | 1 + .gitattributes | 26 ++++++++++++++++++++++++++ .github/workflows/issues.yml | 25 +++++++++++++++++++++++++ .github/workflows/tests.yml | 32 ++++++++++++++++++++++++++++++++ .gitignore | 2 ++ Dockerfile | 24 ++++++++++++++++++++++++ README.md | 1 + entrypoint.sh | 3 +++ src/app.php | 1 + src/composer.json | 1 + 13 files changed, 137 insertions(+) create mode 100644 .dockerignore create mode 100644 .editorconfig create mode 100644 .env.ci create mode 100644 .env.example create mode 100644 .gitattributes create mode 100644 .github/workflows/issues.yml create mode 100644 .github/workflows/tests.yml create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100755 entrypoint.sh create mode 100644 src/app.php create mode 100644 src/composer.json diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e69de29 diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..6f7723b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +# editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.yml] +indent_size = 2 + +[Makefile] +indent_style = tab \ No newline at end of file diff --git a/.env.ci b/.env.ci new file mode 100644 index 0000000..99eb91c --- /dev/null +++ b/.env.ci @@ -0,0 +1 @@ +PHP_VERSION=8.3.6-1 \ No newline at end of file diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..99eb91c --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +PHP_VERSION=8.3.6-1 \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..060412c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,26 @@ +* text=auto + +AUTHORS text +CHANGELOG text +CHANGES text +CONTRIBUTING text +COPYING text +LICENSE text +NEWS text +.editorconfig text +.gitattributes text +.gitconfig text + +.env text +.env.example text +.env.ci text +.gitignore text +.dockerignore text +Dockerfile text +Makefile text +composer.json text eol=lf +*.md text diff=markdown +*.php text diff=php +*.sh text eol=lf +*.yml text +*.json text \ No newline at end of file diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml new file mode 100644 index 0000000..4120b4a --- /dev/null +++ b/.github/workflows/issues.yml @@ -0,0 +1,25 @@ +name: issue + +on: + issues: + types: [opened, edited, reopened] + issue_comment: + types: [created, edited] + +jobs: + send_telegram_message: + name: send telegram message + runs-on: ubuntu-latest + steps: + - name: send telegram message + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + Github. Opened or edited issue + + Author: ${{ github.actor }} + Repository: ${{ github.repository }} + + See changes: https://github.com/${{ github.repository }}/issues/${{ github.event.issue.number }} \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..127d7b6 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,32 @@ +name: tests + +on: + pull_request: ~ + push: + branches: ['*.*.x', 'master'] + +env: + BRANCH: ${{ github.head_ref || github.ref_name }} + +jobs: + docker-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{env.BRANCH}} + + - run: cp .env.ci .env + + - uses: falti/dotenv-action@master + id: dotenv + + - uses: docker/setup-buildx-action@v3 + + - uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + build-args: | + PHP_VERSION=${{ steps.dotenv.outputs.PHP_VERSION }} + push: false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7381ae5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.idea +/.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9bd6dd5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +ARG PHP_VERSION + +FROM rosven9856/php:$PHP_VERSION + +RUN addgroup -g 1000 --system php +RUN adduser -G php --system -D -s /bin/sh -u 1000 php + +RUN chown php:php /home/php +RUN chown php:php /usr/local/bin/composer + +RUN mkdir /var/src +RUN chown -R php:php /var/src + +WORKDIR /var/src + +COPY ./src /var/src + +RUN composer install + +USER php + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a00806f --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +### Building a composer package in GitHub Action diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..97a9ef7 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +php /var/src/app.php \ No newline at end of file diff --git a/src/app.php b/src/app.php new file mode 100644 index 0000000..a814366 --- /dev/null +++ b/src/app.php @@ -0,0 +1 @@ +