Skip to content

publish_release

publish_release #8

Workflow file for this run

name: publish_release
on:
release:
types:
- published
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
environment:
description: 'Deployment environment'
required: true
default: 'production'
commit_id:
description: 'Commit ID (required for manual trigger)'
required: true
jobs:
publish_packages:
runs-on: ubuntu-latest
permissions:
actions: read
steps:
- name: Set commit ID
id: set_commit_id
run: |
if [ "${{ github.event_name }}" == "release" ]; then
commit_id="${{ github.event.release.target_commitish }}"
else
commit_id="${{ github.event.inputs.commit_id }}"
fi
echo "Commit ID: ${commit_id}"
echo "::set-output name=commit_id::${commit_id}"
- name: Find workflow run by commit ID
id: find_workflow
run: |
commit_id="${{ steps.set_commit_id.outputs.commit_id }}"
if [ -z "$commit_id" ]; then
echo "Error: commit_id is empty."
exit 1
fi
echo "Commit ID: ${commit_id}"
workflow_runs=$(gh api -X GET "/repos/${{ github.repository }}/actions/runs?event=push&status=success" -q '.workflow_runs[] | select(.head_commit.id=="'${commit_id}'")')
run_id=$(echo "$workflow_runs" | jq -r '.id')
echo "Run ID: ${run_id}"
echo "::set-output name=run_id::${run_id}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download npm artifact
uses: actions/download-artifact@v4
with:
run-id: ${{ steps.find_workflow.outputs.run_id }}
name: npm
path: bld/npm