Skip to content

Commit

Permalink
feat: deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
dkjensen committed Apr 26, 2022
1 parent 41e1611 commit 0aeb451
Show file tree
Hide file tree
Showing 27 changed files with 1,073 additions and 2,540 deletions.
6 changes: 5 additions & 1 deletion .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,22 @@
/resources
/tests
/bin
/build
/src
/dist
/phpunit.xml

# Files
.babelrc
.commitlintrc.js
.distignore
.editorconfig
.env
.eslintignore
.eslintrc
.eslintrc.json
.gitignore
.releaserc.js
.stylelintignore
.travis.yml
CHANGELOG.md
CODE_OF_CONDUCT.md
Expand All @@ -39,6 +42,7 @@ package-lock.json
package.json
phpcs.xml
phpunit.xml
simple-tabs-block.zip
webpack.config.js
webpack.gutenberg.config.js
webpack.mix.js
52 changes: 52 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run composer install
run: |
composer clear-cache
composer install --no-dev --prefer-dist
- name: Install npm packages
run: |
npm ci
- name: Build
run: |
npm install
npm run build
npm run i18n
- name: Semantic release
id: semantic
uses: codfish/semantic-release-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: WordPress Plugin Deploy
id: deploy
if: steps.semantic.outputs.new-release-published == 'true'
uses: 10up/[email protected]
with:
generate-zip: true
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: simple-tabs-block
VERSION: ${{ steps.semantic.outputs.release-version }}
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.deploy.outputs.zip-path }}
asset_name: ${{ github.event.repository.name }}.zip
asset_content_type: application/zip
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ node_modules/

# dotenv environment variables file
.env

# Build files
dist
33 changes: 33 additions & 0 deletions .releaserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = {
tagFormat: "${version}",
branch: "master",
plugins: [
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "changelog.txt"
}
],
[
"@semantic-release/git",
{
"assets": ["changelog.txt"]
}
],
["@semantic-release/npm", { npmPublish: false }],
"@semantic-release/github",
[
"semantic-release-plugin-update-version-in-files",
{
"files": [
"simple-tabs-block.php",
"readme.txt",
"build/tab/block.json",
"build/tabs/block.json"
],
"placeholder": "0.0.0-development"
}
]
]
};
28 changes: 28 additions & 0 deletions bin/build-zip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

PLUGIN_SLUG="simple-tabs-block"
PROJECT_PATH="."
BUILD_PATH="./dist"
DEST_PATH="$BUILD_PATH/$PLUGIN_SLUG"

echo "Generating build directory..."
rm -rf "$BUILD_PATH"
mkdir -p "$DEST_PATH"

echo "Installing JS dependencies..."
npm i

echo "Running JS Build..."
npm run build || exit "$?"

echo "Syncing files..."
rsync -rc --exclude-from="$PROJECT_PATH/.distignore" "$PROJECT_PATH/" "$DEST_PATH/" --delete --delete-excluded

echo "Generating zip file..."
cd "$BUILD_PATH" || exit
zip -q -r "${PLUGIN_SLUG}.zip" "$PLUGIN_SLUG/"

cd "$PROJECT_PATH" || exit
echo "${PLUGIN_SLUG}.zip file generated!"

echo "Build done!"
2 changes: 1 addition & 1 deletion build/tab/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "cloudcatch/tab",
"version": "1.0.0",
"version": "0.0.0-development",
"title": "Tab",
"category": "design",
"parent": ["cloudcatch/tabs"],
Expand Down
2 changes: 1 addition & 1 deletion build/tab/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '997450abebb6814b2007d947b9d3e04d');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '7e39060d8b5299a21575d03bb9af168e');
3 changes: 0 additions & 3 deletions build/tab/index.css
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
/*!********************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[3].use[3]!./src/tab/editor.scss ***!
\********************************************************************************************************************************************************************************************************************************************/

Loading

0 comments on commit 0aeb451

Please sign in to comment.