-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
38 additions
and
114 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
|
@@ -10,29 +10,15 @@ jobs: | |
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
steps: | ||
- name: Check out code | ||
- name: Check out code 🛒 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
- name: Setup PHP 🐫 | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
|
||
- 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- | ||
- name: Install dependencies | ||
if: steps.composer-cache.outputs.cache-hit != 'true' | ||
id: install-dependencies | ||
run: make composer | ||
|
||
- name: PHPCS checker | ||
- name: PHPCS checker 🧹 | ||
id: php-codesniffer | ||
run: make lint | ||
|
||
|
@@ -53,71 +39,35 @@ jobs: | |
MAINFILE: "bmlt-versions.php" | ||
needs: [ lint ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
id: code-checkout | ||
- name: Check out code 🛒 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build package | ||
- name: Build package 🔧 | ||
id: build-package | ||
run: | | ||
export ZIP_FILENAME=${PLUGIN}-build${GITHUB_RUN_NUMBER}-${GITHUB_SHA}.zip | ||
export ZIP_FILENAME=${PLUGIN}-${GITHUB_REF##*/}.zip | ||
find ./ -type d | xargs chmod 755 | ||
find ./ -name '*.php' | xargs chmod 644 | ||
echo ${GITHUB_SHA} > build.txt | ||
make build | ||
zip $ZIP_FILENAME build.txt | ||
mv $ZIP_FILENAME ${PLUGIN}-${GITHUB_REF##*/}.zip | ||
zip $BUILD_DIR/$ZIP_FILENAME build.txt | ||
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: Generate Release Notes 📝 | ||
if: github.ref_type == 'tag' | ||
run: | | ||
curl -LO https://raw.githubusercontent.com/bmlt-enabled/release-notes-tool/master/gh-release-notes.sh | ||
chmod +x gh-release-notes.sh | ||
./gh-release-notes.sh readme.txt "wp" | ||
echo "ARTIFACT_PATH=./${PLUGIN}-${GITHUB_REF##*/}.zip" >> $GITHUB_ENV | ||
echo "ARTIFACT_NAME=${PLUGIN}-${GITHUB_REF##*/}.zip" >> $GITHUB_ENV | ||
- name: Release beta | ||
if: contains(github.ref, 'beta') | ||
id: beta_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
prerelease: true | ||
draft: false | ||
|
||
- name: Upload Beta Asset | ||
if: contains(github.ref, 'beta') | ||
id: beta-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.beta_release.outputs.upload_url }} | ||
asset_path: ${{ env.ARTIFACT_PATH }} | ||
asset_name: ${{ env.ARTIFACT_NAME }} | ||
asset_content_type: application/zip | ||
|
||
- name: Release stable | ||
if: "!contains(github.ref, 'beta')" | ||
id: stable_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
body_path: "changelog.txt" | ||
prerelease: false | ||
draft: false | ||
RELEASE_TYPE=$(if [[ "$GITHUB_REF_NAME" =~ "beta" ]]; then echo "true"; else echo "false"; fi) | ||
echo "RELEASE_TYPE=${RELEASE_TYPE}" >> $GITHUB_ENV | ||
- name: Upload Stable Asset | ||
if: "!contains(github.ref, 'beta')" | ||
id: stable-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create Release 🎉 | ||
uses: ncipollo/[email protected] | ||
if: github.ref_type == 'tag' | ||
with: | ||
upload_url: ${{ steps.stable_release.outputs.upload_url }} | ||
asset_path: ${{ env.ARTIFACT_PATH }} | ||
asset_name: ${{ env.ARTIFACT_NAME }} | ||
asset_content_type: application/zip | ||
artifacts: ${{ env.ARTIFACT_PATH }} | ||
bodyFile: "changelog.txt" | ||
prerelease: ${{ env.RELEASE_TYPE }} |