Skip to content

Update index.js

Update index.js #8

Workflow file for this run

name: Strong Testimonials Deploy
on:
pull_request:
types:
- closed
branches:
- master
jobs:
build-and-release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: "recursive"
token: ${{ secrets.ACCESS_TOKEN }}
- name: Update submodules
run: |
git config --global url."https://${{ secrets.ACCESS_TOKEN }}@github.com/".insteadOf "https://github.com/"
git submodule update --init --recursive
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install dependencies
run: npm install
- name: Run plugin-zip command
run: npm run plugin-zip
- name: Get version from package.json
id: package-version
uses: martinbeentjes/[email protected]
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.package-version.outputs.current-version }}
release_name: Release ${{ steps.package-version.outputs.current-version }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./strong-testimonials-${{ steps.package-version.outputs.current-version }}.zip
asset_name: strong-testimonials-${{ steps.package-version.outputs.current-version }}.zip
asset_content_type: application/zip
- name: Strong Testimonials Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: strong-testimonials
VERSION: ${{ steps.package-version.outputs.current-version }}
- name: Get changelog
id: changelog
shell: bash
run: |
echo "changelog<<EOF" >> $GITHUB_OUTPUT
version=$(echo "${{ steps.package-version.outputs.current-version }}" | sed 's/^v//')
awk -v ver="$version" '
BEGIN {latest_ver = "0.0.0"}
/^= / {
split($2, a, "-");
if (a[1] <= ver && a[1] > latest_ver) {
latest_ver = a[1];
p = 1;
print "Latest version: " latest_ver;
print "Changelog:";
print;
next;
}
if (p) exit;
}
p
' changelog.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Notify on Slack
uses: bloodyowl/[email protected]
with:
version: ${{ steps.package-version.outputs.current-version }}
changelog: ${{ steps.changelog.outputs.changelog }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}