Skip to content

Commit bbd6e31

Browse files
GitHub action: Publish plugin to Automattic/create-content-model-releases latest on trunk merge (#74)
1 parent e3ebbfc commit bbd6e31

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish plugin to Automattic/create-content-model-releases latest on trunk merge
2+
3+
on:
4+
push:
5+
branches:
6+
- trunk
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: "20"
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Build and create plugin zip
25+
run: npm run plugin-zip
26+
27+
- name: Create output directory
28+
run: mkdir -p output
29+
30+
- name: Move plugin zip to output/
31+
run: mv create-content-model.zip output/
32+
33+
- name: Get user email
34+
id: get_email
35+
run: |
36+
EMAIL=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
37+
https://api.github.com/users/${{ github.actor }} \
38+
| jq -r '.email // empty')
39+
if [ -z "$EMAIL" ]; then
40+
EMAIL="${{ github.actor }}@users.noreply.github.com"
41+
fi
42+
echo "email=$EMAIL" >> $GITHUB_OUTPUT
43+
44+
- name: Push zip to another repository
45+
uses: cpina/github-action-push-to-another-repository@main
46+
env:
47+
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
48+
with:
49+
source-directory: "output"
50+
destination-github-username: "automattic"
51+
destination-repository-name: "create-content-model-releases"
52+
user-name: ${{ github.actor }}
53+
user-email: ${{ steps.get_email.outputs.email }}
54+
target-branch: latest

0 commit comments

Comments
 (0)