diff --git a/.github/workflows/branch.yaml b/.github/workflows/branch.yaml new file mode 100644 index 0000000..2a9267e --- /dev/null +++ b/.github/workflows/branch.yaml @@ -0,0 +1,55 @@ +name: branch + +on: + pull_request: + types: + - opened + - synchronize + +permissions: + actions: read + contents: read + +jobs: + security: + permissions: + contents: read + checks: read + statuses: read + security-events: write + uses: affinidi/pipeline-security/.github/workflows/security-scanners.yml@main + with: + config-path: .github/labeler.yml + secrets: inherit + validate-package: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup PHP with PECL extension + uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Install dependencies + run: composer install + + - name: Lint PHP files + uses: overtrue/phplint@main + with: + path: . + options: --exclude=vendor + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..92ac3d6 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,35 @@ +name: Release +"on": + push: + branches: + - main +permissions: + contents: read # for checkout +jobs: + release: + permissions: + contents: write # to be able to publish a GitHub release + issues: write # to be able to comment on released issues + pull-requests: write # to be able to comment on released pull requests + name: release + runs-on: ubuntu-latest + steps: + - name: Generate token from app token #https://github.com/tibdex/github-app-token + id: generate_token + uses: tibdex/github-app-token@v2 + with: + app_id: ${{ secrets.RELEASE_BOT_APP_ID }} + private_key: ${{ secrets.RELEASE_BOT_PKEY }} + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + cache: npm + node-version: lts/* + - name: configure git + run: | + git config user.name "${GITHUB_ACTOR}" + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + - run: npm clean-install + - run: npx semantic-release@24.2.0 + env: + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} \ No newline at end of file diff --git a/composer.json b/composer.json index 4660c46..1820972 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,12 @@ "Minbash\\Getsecure\\": "src/" } }, + "scripts": { + "build": [ + "@composer --no-plugins --no-interaction install --no-scripts --no-dev", + "@composer --no-plugins --no-interaction archive" + ] + }, "require": { "php": ">=7.4" }