Skip to content

Commit

Permalink
feat(wordpress): publish workflow to aws
Browse files Browse the repository at this point in the history
  • Loading branch information
icaparros-at-wiris committed Oct 19, 2023
1 parent dd46343 commit 1bd003c
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 48 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/publish-wordpress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,105 @@ on:
Type `publish_aws` to do publish to S3, any other value otherwise.
required: false
default: ""
version:
description: |
Version number, e.g.: "8.5.0"
required: false
default: ""

# Array of jobs to run in this workflow
jobs:
publish-wordpres:
runs-on: ubuntu-latest

if: github.event.inputs.publish_aws == 'publish_aws'

steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18

# Install dependencies and create compiled files
- name: Build the JavaScript
run: |
yarn install
npx nx build wordpress
- name: Create Icons folder inside the build one
run: |
cp -a packages/wordpress/src/icons/ packages/wordpress/build/icons/
echo ${{ github.event.inputs.version }} > VERSION
# Create a zip file with the files needed to integrate
# Mathtype for WordPress
- name: Zip integration
uses: vimtor/action-zip@v1
with:
files: packages/wordpress/build/ VERSION
dest: mathtype-tinymce-wordpress_${{ github.event.inputs.version }}.zip
- uses: vimtor/action-zip@v1
with:
files: packages/wordpress/src/tiny_mce_wiris.php
dest: wordpress-wiris_${{ github.event.inputs.version }}.zip

- name: Write the manifest of MathType for WordPress
run: |
cat << EOF > manifest.json
{
"items": [
{
"tech": ["javascript", "php"],
"editor": "tinymce5",
"version": "${{ github.event.inputs.version }}",
"date": "$(date -u +"%FT%T.000Z")",
"published": true,
"url": "https://downloads.wiris.com/integrations/wordpress/${{ github.event.inputs.version }}/java-oxygenxml_${{ github.event.inputs.version }}.zip",
"storename": "WORDPRESS"
}
]
}
EOF
# Release WordPress plugin
- name: Release on GitHub
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: "latest"
prerelease: true
title: "CI"
files: |
*.zip
- name: Upload artifacts to S3 rebost staging
env:
AWS_ACCESS_KEY_ID: ${{ secrets.REBOST_STG_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.REBOST_STG_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.STG_AWS_DEFAULT_REGION }}
AWS_DEFAULT_OUTPUT: json
S3_BUCKET: wiris-rebost-staging
S3_PATH: publish/integrations/wordpress
run: |
aws s3 cp --recursive --exclude "*" --include "*.zip" --exclude "**/*.zip" --include "manifest.json" . s3://${S3_BUCKET}/${S3_PATH}/${{ github.event.inputs.version }}/
- name: Upload artifacts to S3 downloads staging
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DOWNLOADS_STG_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DOWNLOADS_STG_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.STG_AWS_DEFAULT_REGION }}
AWS_DEFAULT_OUTPUT: json
S3_BUCKET: wiris-downloads-staging
S3_PATH: integrations/wordpress
run: |
aws s3 cp --recursive --exclude "*" --include "*.zip" --exclude "**/*.zip" . s3://${S3_BUCKET}/${S3_PATH}/${{ github.event.inputs.version }}/
- name: Trigger Store staging links update
env:
AWS_ACCESS_KEY_ID: ${{ secrets.STORE_STG_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.STORE_STG_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.STG_AWS_DEFAULT_REGION }}
S3_BUCKET: wiris-store-staging-pipeline
run: |
mv manifest.json deploy
aws deploy push --application-name store-downloads --s3-location s3://${S3_BUCKET}/wordpress.zip --source deploy
47 changes: 0 additions & 47 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,50 +48,3 @@ jobs:
# Call the script that interacts with the yarn CLI
./scripts/publish.mjs ${{ github.event.inputs.versions }}
publish-wordpress:
runs-on: ubuntu-latest

# If we want to publish the WordPress plugin, which is not needed on npm.
if: contains(github.event.inputs, 'wordpress')

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16

- name: Checkout
uses: actions/checkout@v2

# Install dependencies and create compiled files
- name: Build the JavaScript
run: |
yarn install
nx build wordpress
- name: Create Icons folder inside the build one
run: |
cp -a packages/wordpress/src/icons/ packages/wordpress/build/icons/
# Create a zip file with the files needed to integrate
# Mathtype for WordPress
- name: Zip integration
uses: vimtor/action-zip@v1
with:
files: build/ VERSION
dest: "mathtype-tinymce-wordpress_${{ github.event.inputs.version }}.zip"
- uses: vimtor/action-zip@v1
with:
files: wordpress-wiris-plugin/tiny_mce_wiris.php
dest: "wordpress-wiris_${{ github.event.inputs.version }}.zip"

# Release WordPress plugin
- name: Release on GitHub
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: "latest"
prerelease: true
title: "CI"
files: |
*.zip
1 change: 0 additions & 1 deletion packages/wordpress/VERSION

This file was deleted.

0 comments on commit 1bd003c

Please sign in to comment.