-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
872ec37
commit a5b740f
Showing
11 changed files
with
409 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: Build and publish the ZIP build file | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, ready_for_review] | ||
branches-ignore: | ||
- 'update_dependencies' | ||
jobs: | ||
dev-zip: | ||
name: Build ZIP and upload to s3 | ||
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | ||
runs-on: ubuntu-latest | ||
outputs: | ||
branch-name: ${{ steps.retrieve-branch-name.outputs.branch_name }} | ||
git-sha-8: ${{ steps.retrieve-git-sha-8.outputs.sha8 }} | ||
steps: | ||
- name: Check out source files | ||
uses: actions/checkout@v2 | ||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Configure Composer cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install composer deps | ||
run: composer install --no-dev --prefer-dist --no-progress --no-suggest | ||
- name: Install npm deps | ||
run: npm ci | ||
- name: Build files | ||
run: npm run build | ||
- name: Create zip | ||
run: npm run dist | ||
- name: Retrieve branch name | ||
id: retrieve-branch-name | ||
run: echo "::set-output name=branch_name::$(REF=${GITHUB_HEAD_REF:-$GITHUB_REF} && echo ${REF#refs/heads/} | sed 's/\//-/g')" | ||
- name: Retrieve git SHA-8 string | ||
id: retrieve-git-sha-8 | ||
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" | ||
- name: Upload Latest Version to S3 | ||
uses: jakejarvis/s3-sync-action@master | ||
with: | ||
args: --acl public-read --follow-symlinks --delete | ||
env: | ||
AWS_S3_BUCKET: ${{ secrets.AWS_DEV_BUCKET }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_AWS_KEY_ARTIFACTS }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_AWS_SECRET_ARTIFACTS }} | ||
SOURCE_DIR: artifact/ | ||
DEST_DIR: ${{ github.event.pull_request.base.repo.name }}-${{ steps.retrieve-branch-name.outputs.branch_name }}-${{ steps.retrieve-git-sha-8.outputs.sha8 }}/ | ||
|
||
comment-on-pr: | ||
name: Comment on PR with links to plugin ZIPs | ||
if: ${{ github.head_ref && github.head_ref != null }} | ||
runs-on: ubuntu-latest | ||
needs: dev-zip | ||
env: | ||
CI: true | ||
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
outputs: | ||
pr_number: ${{ steps.get-pr-number.outputs.num }} | ||
comment_body: ${{ steps.get-comment-body.outputs.body }} | ||
steps: | ||
- name: Get PR number | ||
id: get-pr-number | ||
run: echo "::set-output name=num::$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')" | ||
|
||
- name: Check if a comment was already made | ||
id: find-comment | ||
uses: peter-evans/find-comment@v2 | ||
with: | ||
issue-number: ${{ steps.get-pr-number.outputs.num }} | ||
comment-author: github-actions[bot] | ||
body-includes: Download Plugin - [Download] | ||
|
||
- name: Get comment body | ||
id: get-comment-body | ||
run: | | ||
body="Plugin build for ${{ github.event.pull_request.head.sha }} is ready :bellhop_bell:! | ||
- Download Plugin - [Download](https://verti-artifacts.s3.amazonaws.com/${{ github.event.pull_request.base.repo.name }}-${{ needs.dev-zip.outputs.branch-name }}-${{ needs.dev-zip.outputs.git-sha-8 }}/hyve-lite.zip)" | ||
body="${body//$'\n'/'%0A'}" | ||
echo "::set-output name=body::$body" | ||
- name: Create comment on PR with links to plugin builds | ||
if: ${{ steps.find-comment.outputs.comment-id == '' }} | ||
uses: peter-evans/create-or-update-comment@v2 | ||
with: | ||
issue-number: ${{ steps.get-pr-number.outputs.num }} | ||
body: ${{ steps.get-comment-body.outputs.body }} | ||
|
||
- name: Update comment on PR with links to plugin builds | ||
if: ${{ steps.find-comment.outputs.comment-id != '' }} | ||
uses: peter-evans/create-or-update-comment@v2 | ||
with: | ||
comment-id: ${{ steps.find-comment.outputs.comment-id }} | ||
edit-mode: replace | ||
body: ${{ steps.get-comment-body.outputs.body }} |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
create_tag: | ||
runs-on: ubuntu-latest | ||
if: "! contains(github.event.head_commit.message, '[skip ci]')" | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
steps: | ||
- uses: actions/checkout@master | ||
with: | ||
persist-credentials: false | ||
- name: Build files using ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Release new version | ||
id: release | ||
run: | | ||
npm ci | ||
npm run release | ||
env: | ||
CI: true | ||
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
GIT_AUTHOR_NAME: themeisle[bot] | ||
GIT_AUTHOR_EMAIL: ${{ secrets.BOT_EMAIL }} | ||
GIT_COMMITTER_NAME: themeisle[bot] | ||
GIT_COMMITTER_EMAIL: ${{ secrets.BOT_EMAIL }} | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_ANNOUNCEMENTS }} | ||
SEMANTIC_RELEASE_PACKAGE: Hyve Lite | ||
empty-job: | ||
# if no jobs run, github action considers it a test failure -- which seems like a bug | ||
# this makes it so the top-level if statement for the job does not give status failure. | ||
runs-on: ubuntu-latest | ||
if: success() | ||
steps: | ||
- name: Meep | ||
run: | | ||
echo "Nothing to do" |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Deploy | ||
on: | ||
push: | ||
tags: | ||
- "*" | ||
jobs: | ||
tag: | ||
name: Deploy to WordPress.org | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Get the version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} | ||
- name: Install composer deps | ||
run: composer install --no-dev --prefer-dist --no-progress --no-suggest | ||
- name: Install npm deps | ||
run: npm ci | ||
- name: Build files | ||
run: npm run build | ||
- name: Build zip | ||
run: npm run dist | ||
- name: Upload Latest Version to S3 | ||
uses: jakejarvis/s3-sync-action@master | ||
with: | ||
args: --acl public-read --follow-symlinks --delete | ||
env: | ||
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_DOWNLOADS }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_DOWNLOADS_AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DOWNLOADS_AWS_SECRET_ACCESS_KEY }} | ||
AWS_REGION: 'us-west-1' # optional: defaults to us-east-1 | ||
SOURCE_DIR: 'artifact' # optional: defaults to entire repository | ||
DEST_DIR: ${{ secrets.S3_AWS_PRODUCTS_FOLDER }}/hyve-lite/latest | ||
- name: Upload Tagged Version to S3 | ||
uses: jakejarvis/s3-sync-action@master | ||
with: | ||
args: --acl public-read --follow-symlinks --delete | ||
env: | ||
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_DOWNLOADS }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_DOWNLOADS_AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DOWNLOADS_AWS_SECRET_ACCESS_KEY }} | ||
AWS_REGION: 'us-west-1' # optional: defaults to us-east-1 | ||
SOURCE_DIR: 'artifact' # optional: defaults to entire repository | ||
DEST_DIR: ${{ secrets.S3_AWS_PRODUCTS_FOLDER }}/hyve-lite/$BUILD_VERSION | ||
- name: Send update to the store | ||
env: | ||
PRODUCT_ID: ${{ secrets.THEMEISLE_ID }} | ||
AUTH_TOKEN: ${{ secrets.THEMEISLE_STORE_AUTH }} | ||
STORE_URL: ${{ secrets.THEMEISLE_STORE_URL }} | ||
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
BUILD_VERSION: ${{ steps.get_version.outputs.VERSION }} | ||
uses: Codeinwp/action-store-release@main |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: "Issue Labeler" | ||
on: | ||
issues: | ||
types: [opened] | ||
|
||
jobs: | ||
triage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: github/issue-labeler@master | ||
with: | ||
repo-token: "${{ secrets.BOT_TOKEN }}" | ||
enable-versioned-regex: 0 | ||
configuration-path: .github/labeler.yml |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Add to project | ||
|
||
on: | ||
issues: | ||
types: [opened,transferred] | ||
|
||
jobs: | ||
add-to-project: | ||
name: Add issue to project | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/add-to-project@main | ||
id: add_project | ||
with: | ||
project-url: ${{ secrets.PROJECT_PLANNING }} | ||
github-token: ${{ secrets.BOT_TOKEN_PROJECT }} | ||
- name: Set Team | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN_PROJECT }} | ||
run: | | ||
gh api graphql -f query=' | ||
mutation( | ||
$project: ID! | ||
$item: ID! | ||
$status_field: ID! | ||
$status_value: String! | ||
) { | ||
updateProjectV2ItemFieldValue( | ||
input: { | ||
projectId: $project | ||
itemId: $item | ||
fieldId: $status_field | ||
value: { | ||
singleSelectOptionId: $status_value | ||
} | ||
} | ||
) { | ||
projectV2Item { | ||
id | ||
} | ||
} | ||
}' -f project=${{ secrets.PROJECT_PLANNING_ID }} -f item=${{ steps.add_project.outputs.itemId }} -f status_field=${{ secrets.PLANNING_TEAM_FIELD_ID }} -f status_value=620890b9 --silent |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Sync branches | ||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
- 'development' | ||
jobs: | ||
sync-branch: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.repository_owner == 'Codeinwp' }} # Disable on forks | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Retrieve branch name | ||
id: retrieve-branch-name | ||
run: echo "::set-output name=branch_name::$(REF=${GITHUB_HEAD_REF:-$GITHUB_REF} && echo ${REF#refs/heads/} | sed 's/\//-/g')" | ||
- name: Merge master -> development | ||
if: ${{ steps.retrieve-branch-name.outputs.branch_name == 'master' }} | ||
uses: Codeinwp/merge-branch@master | ||
with: | ||
type: now | ||
from_branch: master | ||
target_branch: development | ||
github_token: ${{ secrets.BOT_TOKEN }} | ||
- name: Merge development -> next | ||
if: ${{ steps.retrieve-branch-name.outputs.branch_name == 'development' }} | ||
uses: Codeinwp/merge-branch@master | ||
with: | ||
type: now | ||
from_branch: development | ||
target_branch: next | ||
github_token: ${{ secrets.BOT_TOKEN }} |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Test JS | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, ready_for_review] | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
name: JS Test | ||
steps: | ||
- uses: actions/checkout@master | ||
with: | ||
persist-credentials: false | ||
- name: Build files using ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Lint js files | ||
run: | | ||
npm install -g npm | ||
npm ci | ||
npm run lint:js | ||
env: | ||
CI: true |
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Test PHP | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, ready_for_review] | ||
|
||
jobs: | ||
phplint: | ||
name: PHPLint | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | ||
steps: | ||
- name: Setup PHP version | ||
uses: shivammathur/setup-php@v1 | ||
with: | ||
php-version: '7.4' | ||
extensions: simplexml | ||
- name: Checkout source code | ||
uses: actions/checkout@v2 | ||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Setup Composer cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install composer | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
- name: Run PHPCS | ||
run: composer run lint | ||
|
||
phpstan: | ||
name: PHPStan | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | ||
steps: | ||
- name: Setup PHP version | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
extensions: simplexml, mysql | ||
- name: Checkout source code | ||
uses: actions/checkout@v2 | ||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Setup Composer cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install composer | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
- name: PHPStan Static Analysis | ||
run: composer phpstan |
Empty file.
Oops, something went wrong.