Code style. #352
Workflow file for this run
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
| name: Create zip | |
| on: | |
| push: | |
| workflow_dispatch: | |
| permissions: | |
| actions: read | |
| contents: write | |
| jobs: | |
| build-zip: | |
| name: New zip file | |
| runs-on: ubuntu-latest | |
| # Security: 1. Check for [zip] tag. 2. Check if user is authorized. | |
| if: | | |
| (github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[zip]')) && | |
| contains(fromJson('["kagg-design", "e271828-"]'), github.actor) | |
| env: | |
| SLUG: "hcaptcha-for-forms-and-more" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Install dependencies with caching | |
| uses: hCaptcha/composer-install@e52779489de843a9f022c7b8faa648b608b02c70 | |
| with: | |
| composer-options: "--no-dev --optimize-autoloader --classmap-authoritative" | |
| - name: Install JS packages | |
| run: | | |
| corepack enable | |
| yarn set version stable | |
| yarn | |
| yarn prod | |
| - name: Get version from PHP file | |
| id: get_version | |
| shell: bash | |
| run: | | |
| VERSION=$(grep -oP "const HCAPTCHA_VERSION = '\K[^']+" hcaptcha.php) | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Create zip file | |
| id: make_zip | |
| shell: bash | |
| run: | | |
| echo "➤ Creating target directory..." | |
| mkdir -p trunk/${SLUG} | |
| echo "➤ Copying files..." | |
| rsync -rc --exclude-from="$GITHUB_WORKSPACE/.distignore" "$GITHUB_WORKSPACE/" trunk/${SLUG}/ --delete --delete-excluded | |
| echo "➤ Generating zip file..." | |
| cd trunk | |
| zip -r "${{ github.workspace }}/${{ env.SLUG }}.${{ env.VERSION }}.zip" . | |
| echo "zip-path=${GITHUB_WORKSPACE}/${SLUG}.${VERSION}.zip" >> "${GITHUB_OUTPUT}" | |
| echo "✓ Zip file generated!" | |
| - name: Create pre-release (published) and upload asset | |
| uses: hCaptcha/action-gh-release@ab50eebb6488051c6788d97fa95232267c6a4e23 | |
| with: | |
| files: ${{ github.workspace }}/${{ env.SLUG }}.${{ env.VERSION }}.zip | |
| draft: false | |
| prerelease: true | |
| tag_name: v${{ env.VERSION }} | |
| name: "v${{ env.VERSION }} (build ${{ github.run_number }})" | |
| body: | | |
| Automated pre-release for testing. | |
| Branch: ${{ github.ref_name }} | |
| Commit: ${{ github.sha }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Print release URL | |
| run: | | |
| echo "Use URL in blueprint:" | |
| echo "https://github.com/${{ github.repository }}/releases/download/v${{ env.VERSION }}/${{ env.SLUG }}.${{ env.VERSION }}.zip" |