Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub action: Publish plugin to Automattic/create-content-model-releases latest on trunk merge #74

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/publish-latest-plugin-zip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish plugin to Automattic/create-content-model-releases latest on trunk merge

on:
push:
branches:
- trunk

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies
run: npm ci

- name: Build and create plugin zip
run: npm run plugin-zip

- name: Create output directory
run: mkdir -p output

- name: Move plugin zip to output/
run: mv create-content-model.zip output/

- name: Get user email
id: get_email
run: |
EMAIL=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/users/${{ github.actor }} \
| jq -r '.email // empty')
if [ -z "$EMAIL" ]; then
EMAIL="${{ github.actor }}@users.noreply.github.com"
fi
echo "email=$EMAIL" >> $GITHUB_OUTPUT

- name: Push zip to another repository
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: "output"
destination-github-username: "automattic"
destination-repository-name: "create-content-model-releases"
user-name: ${{ github.actor }}
user-email: ${{ steps.get_email.outputs.email }}
target-branch: latest