Fix release workflow sed command (#114) #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "tagged-release" | |
on: | |
push: | |
tags: | |
- "*" | |
jobs: | |
tagged-release: | |
name: "Tagged Release" | |
runs-on: "ubuntu-latest" | |
outputs: | |
tag_name: ${{ steps.get_tag.outputs.tag_name }} | |
steps: | |
- uses: actions/checkout@master | |
- name: Get tag name | |
id: get_tag | |
run: echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Fetch Tags | |
run: git fetch --tags --force | |
- id: tag-message | |
run: git tag -l --sort=-taggerdate --format='%(contents)' $(git describe --tags $(git branch --show-current)) | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
- run: npm install | |
- run: "find . -type f -exec sed -i 's/0.0.0-placeholder/${{ steps.get_tag.outputs.tag_name }}/g' {} +" | |
- run: npm run plugin-zip | |
- uses: softprops/action-gh-release@v2 | |
with: | |
body: ${{ steps.tag-message.outputs.stdout }} | |
files: create-content-model.zip | |
make_latest: true | |
- name: Upload plugin zip | |
uses: actions/upload-artifact@v4 | |
with: | |
name: plugin-zip | |
path: create-content-model.zip | |
publish-to-releases-repo: | |
name: "Publish to Releases Repository" | |
needs: tagged-release | |
runs-on: "ubuntu-latest" | |
steps: | |
# Download the artifact from the previous job | |
- name: Download plugin zip | |
uses: actions/download-artifact@v4 | |
with: | |
name: 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 create-content-model-releases 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: releases | |
commit-message: "${{ needs.tagged-release.outputs.tag_name }} from ORIGIN_COMMIT" |