columns (#4) #11
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: "release" | |
| on: | |
| push: | |
| tags: ["*"] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Check out code 🛒 | |
| uses: actions/checkout@v6 | |
| - name: Setup PHP 🐫 | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.3 | |
| tools: composer | |
| - name: Install dependencies 📦 | |
| run: composer install --prefer-dist --no-progress | |
| - name: Linter 🧹 | |
| run: make lint | |
| - name: PHP syntax check 🔍 | |
| run: | | |
| set -e | |
| find . -type f \( -name '*.php' -o -name '*.module' -o -name '*.install' \) \ | |
| ! -path './vendor/*' ! -path './build/*' -print0 \ | |
| | xargs -0 -n1 -P4 php -l | |
| test: | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| matrix: | |
| php-version: ["8.3", "8.4"] | |
| steps: | |
| - name: Check out code 🛒 | |
| uses: actions/checkout@v6 | |
| - name: Setup PHP 🐫 | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| extensions: mbstring, dom, gd, pdo_sqlite | |
| tools: composer | |
| - name: Install dependencies 📦 | |
| run: composer install --prefer-dist --no-progress | |
| - name: Run PHPUnit 🧪 | |
| run: vendor/bin/phpunit --colors=always | |
| package: | |
| runs-on: ubuntu-24.04 | |
| env: | |
| BUILD_DIR: build | |
| DIST_DIR_GITHUB: dist/github | |
| MODULE: crumb | |
| GITHUB_RELEASE_FILENAME: crumb.zip | |
| needs: [lint, test] | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check out code 🛒 | |
| uses: actions/checkout@v6 | |
| - name: Build package 🔧 | |
| run: | | |
| export ZIP_FILENAME=${MODULE}-${GITHUB_REF##*/}.zip | |
| find ./ -type d -exec chmod 755 {} + | |
| find ./ -name '*.php' -exec chmod 644 {} + | |
| make build | |
| # Embed the build SHA INSIDE the module directory of the zip, | |
| # so the zip extracts cleanly as a single self-contained module dir. | |
| mkdir -p $BUILD_DIR/_inject/$MODULE | |
| echo $GITHUB_SHA > $BUILD_DIR/_inject/$MODULE/build.txt | |
| (cd $BUILD_DIR/_inject && zip -g "../$ZIP_FILENAME" $MODULE/build.txt) | |
| rm -rf $BUILD_DIR/_inject | |
| mkdir -p $DIST_DIR_GITHUB && cp $BUILD_DIR/$ZIP_FILENAME $DIST_DIR_GITHUB/$GITHUB_RELEASE_FILENAME | |
| echo "ARTIFACT_PATH=$DIST_DIR_GITHUB/$GITHUB_RELEASE_FILENAME" >> $GITHUB_ENV | |
| echo "ARTIFACT_NAME=${ZIP_FILENAME}" >> $GITHUB_ENV | |
| - name: Extract changelog and determine release type 📝 | |
| if: github.ref_type == 'tag' | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| awk -v ver="$VERSION" ' | |
| $0 ~ "^## " ver "( |$|\\()" || $0 ~ "^## \\[" ver "\\]" { found = 1; next } | |
| /^## / && found { exit } | |
| found { print } | |
| ' CHANGELOG.md > changelog.txt | |
| if [ ! -s changelog.txt ]; then | |
| echo "Release ${GITHUB_REF_NAME}." > changelog.txt | |
| fi | |
| echo "--- release notes ---" | |
| cat changelog.txt | |
| RELEASE_TYPE=$(if [[ "$GITHUB_REF_NAME" =~ "beta" || "$GITHUB_REF_NAME" =~ "alpha" || "$GITHUB_REF_NAME" =~ "rc" ]]; then echo "true"; else echo "false"; fi) | |
| echo "RELEASE_TYPE=${RELEASE_TYPE}" >> $GITHUB_ENV | |
| - name: Create Release 🎉 | |
| if: github.ref_type == 'tag' | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| artifacts: ${{ env.ARTIFACT_PATH }} | |
| bodyFile: "changelog.txt" | |
| prerelease: ${{ env.RELEASE_TYPE }} |