Skip to content

Commit 20c8895

Browse files
committed
ci fixes
1 parent ecb5356 commit 20c8895

File tree

3 files changed

+38
-114
lines changed

3 files changed

+38
-114
lines changed

.github/workflows/latest.yml

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,23 @@ name: 'latest'
22

33
on:
44
push:
5-
branches: [ 'master' ]
5+
branches: [ 'main' ]
66

77
jobs:
88
lint:
99
runs-on: ubuntu-latest
1010
env:
1111
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
1212
steps:
13-
- name: Check out code
14-
uses: actions/checkout@v2
13+
- name: Check out code 🛒
14+
uses: actions/checkout@v3
1515

16-
- name: Setup PHP
16+
- name: Setup PHP 🐫
1717
uses: shivammathur/setup-php@v2
1818
with:
1919
php-version: 7.4
2020

21-
- name: Cache Composer packages
22-
id: composer-cache
23-
uses: actions/cache@v3
24-
with:
25-
path: vendor
26-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
27-
restore-keys: |
28-
${{ runner.os }}-php-
29-
30-
- name: Install dependencies
31-
if: steps.composer-cache.outputs.cache-hit != 'true'
32-
id: install-dependencies
33-
run: make composer
34-
35-
- name: PHPCS checker
21+
- name: PHPCS checker 🧹
3622
id: php-codesniffer
3723
run: make lint
3824

@@ -57,29 +43,30 @@ jobs:
5743
PLUGIN: "bmlt-versions"
5844
needs: [ lint ]
5945
steps:
60-
- uses: actions/checkout@v3
46+
- name: Check out code 🛒
47+
uses: actions/checkout@v3
6148
id: code-checkout
6249

63-
- name: Prepare to deploy
50+
- name: Prepare to deploy 🔧
6451
run: |
6552
export FILENAME=${PLUGIN}-build-${GITHUB_RUN_NUMBER}-${GITHUB_SHA}
6653
export ZIP_FILENAME=$FILENAME.zip
6754
echo "ZIP_FILENAME=${ZIP_FILENAME}" >> $GITHUB_ENV
6855
make build
6956
mkdir -p ${DIST_DIR_S3} && cp ${BUILD_DIR}/${ZIP_FILENAME} ${DIST_DIR_S3}/${ZIP_FILENAME}
7057
71-
- name: configure aws credentials
58+
- name: configure aws credentials 🪪
7259
uses: aws-actions/configure-aws-credentials@v1
7360
with:
7461
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions/gh-ci-s3-artifact
7562
role-session-name: gh-actions-${{ env.PLUGIN }}
7663
aws-region: us-east-1
7764

78-
- name: copy artifact to s3
65+
- name: copy artifact to s3 🪣
7966
run: |
8067
aws s3 cp $DIST_DIR_S3/$ZIP_FILENAME s3://$S3_BUCKET/$S3_KEY/$ZIP_FILENAME
8168
82-
- name: Publish Release to Latest WP
69+
- name: Publish Release to Latest WP 🎉
8370
id: publish_latest
8471
uses: bmlt-enabled/wordpress-releases-github-action@v1
8572
with:

.github/workflows/pull-requests.yml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,20 @@ name: 'pull-request'
22

33
on:
44
pull_request:
5-
branches: [ 'master' ]
5+
branches: [ 'main' ]
66

77
jobs:
88
lint:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
11+
- name: Check out code 🛒
12+
uses: actions/checkout@v3
1213
id: code-checkout
1314

14-
- name: Validate composer.json and composer.lock
15+
- name: Validate composer.json and composer.lock 🎼
1516
id: composer-validate
1617
run: composer validate
1718

18-
- name: Cache Composer packages
19-
id: composer-cache
20-
uses: actions/cache@v3
21-
with:
22-
path: vendor
23-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
24-
restore-keys: |
25-
${{ runner.os }}-php-
26-
27-
- name: Install dependencies
28-
if: steps.composer-cache.outputs.cache-hit != 'true'
29-
id: install-dependencies
30-
run: make composer
31-
32-
- name: PHPCS checker
19+
- name: PHPCS checker 🧹
3320
id: php-codesniffer
3421
run: make lint

.github/workflows/release.yml

Lines changed: 22 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,15 @@ jobs:
1010
env:
1111
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
1212
steps:
13-
- name: Check out code
13+
- name: Check out code 🛒
1414
uses: actions/checkout@v3
1515

16-
- name: Setup PHP
16+
- name: Setup PHP 🐫
1717
uses: shivammathur/setup-php@v2
1818
with:
1919
php-version: 7.4
2020

21-
- name: Cache Composer packages
22-
id: composer-cache
23-
uses: actions/cache@v3
24-
with:
25-
path: vendor
26-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
27-
restore-keys: |
28-
${{ runner.os }}-php-
29-
30-
- name: Install dependencies
31-
if: steps.composer-cache.outputs.cache-hit != 'true'
32-
id: install-dependencies
33-
run: make composer
34-
35-
- name: PHPCS checker
21+
- name: PHPCS checker 🧹
3622
id: php-codesniffer
3723
run: make lint
3824

@@ -53,71 +39,35 @@ jobs:
5339
MAINFILE: "bmlt-versions.php"
5440
needs: [ lint ]
5541
steps:
56-
- uses: actions/checkout@v3
57-
id: code-checkout
42+
- name: Check out code 🛒
43+
uses: actions/checkout@v3
5844

59-
- name: Build package
45+
- name: Build package 🔧
6046
id: build-package
6147
run: |
62-
export ZIP_FILENAME=${PLUGIN}-build${GITHUB_RUN_NUMBER}-${GITHUB_SHA}.zip
48+
export ZIP_FILENAME=${PLUGIN}-${GITHUB_REF##*/}.zip
6349
find ./ -type d | xargs chmod 755
6450
find ./ -name '*.php' | xargs chmod 644
6551
echo ${GITHUB_SHA} > build.txt
6652
make build
67-
zip $ZIP_FILENAME build.txt
68-
mv $ZIP_FILENAME ${PLUGIN}-${GITHUB_REF##*/}.zip
53+
zip $BUILD_DIR/$ZIP_FILENAME build.txt
6954
mkdir -p $DIST_DIR_GITHUB && cp $BUILD_DIR/$ZIP_FILENAME $DIST_DIR_GITHUB/$GITHUB_RELEASE_FILENAME
55+
echo "ARTIFACT_PATH=$DIST_DIR_GITHUB/$GITHUB_RELEASE_FILENAME" >> $GITHUB_ENV
56+
echo "ARTIFACT_NAME=${ZIP_FILENAME}" >> $GITHUB_ENV
57+
58+
- name: Generate Release Notes 📝
59+
if: github.ref_type == 'tag'
60+
run: |
7061
curl -LO https://raw.githubusercontent.com/bmlt-enabled/release-notes-tool/master/gh-release-notes.sh
7162
chmod +x gh-release-notes.sh
7263
./gh-release-notes.sh readme.txt "wp"
73-
echo "ARTIFACT_PATH=./${PLUGIN}-${GITHUB_REF##*/}.zip" >> $GITHUB_ENV
74-
echo "ARTIFACT_NAME=${PLUGIN}-${GITHUB_REF##*/}.zip" >> $GITHUB_ENV
75-
76-
- name: Release beta
77-
if: contains(github.ref, 'beta')
78-
id: beta_release
79-
uses: actions/create-release@v1
80-
env:
81-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82-
with:
83-
tag_name: ${{ github.ref }}
84-
release_name: ${{ github.ref }}
85-
prerelease: true
86-
draft: false
87-
88-
- name: Upload Beta Asset
89-
if: contains(github.ref, 'beta')
90-
id: beta-release-asset
91-
uses: actions/upload-release-asset@v1
92-
env:
93-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94-
with:
95-
upload_url: ${{ steps.beta_release.outputs.upload_url }}
96-
asset_path: ${{ env.ARTIFACT_PATH }}
97-
asset_name: ${{ env.ARTIFACT_NAME }}
98-
asset_content_type: application/zip
99-
100-
- name: Release stable
101-
if: "!contains(github.ref, 'beta')"
102-
id: stable_release
103-
uses: actions/create-release@v1
104-
env:
105-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106-
with:
107-
tag_name: ${{ github.ref }}
108-
release_name: ${{ github.ref }}
109-
body_path: "changelog.txt"
110-
prerelease: false
111-
draft: false
64+
RELEASE_TYPE=$(if [[ "$GITHUB_REF_NAME" =~ "beta" ]]; then echo "true"; else echo "false"; fi)
65+
echo "RELEASE_TYPE=${RELEASE_TYPE}" >> $GITHUB_ENV
11266
113-
- name: Upload Stable Asset
114-
if: "!contains(github.ref, 'beta')"
115-
id: stable-release-asset
116-
uses: actions/upload-release-asset@v1
117-
env:
118-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
- name: Create Release 🎉
68+
uses: ncipollo/release-action@v1.11.1
69+
if: github.ref_type == 'tag'
11970
with:
120-
upload_url: ${{ steps.stable_release.outputs.upload_url }}
121-
asset_path: ${{ env.ARTIFACT_PATH }}
122-
asset_name: ${{ env.ARTIFACT_NAME }}
123-
asset_content_type: application/zip
71+
artifacts: ${{ env.ARTIFACT_PATH }}
72+
bodyFile: "changelog.txt"
73+
prerelease: ${{ env.RELEASE_TYPE }}

0 commit comments

Comments
 (0)