Skip to content

Update Release Metadata #62

Update Release Metadata

Update Release Metadata #62

name: Update Release Metadata
on:
workflow_dispatch: # Allows the workflow to be run manually via the GitHub Actions interface
workflow_run: # Allows the workflow to trigger when another workflow completes
workflows: ["Build and Publish PHP Extension"]
types:
- completed
permissions:
contents: write
jobs:
update-release:
name: Update release metadata
runs-on: ubuntu-latest
# Run the job only when triggered manually or when the triggering workflow completed successfully
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Cache Python Dependencies
uses: actions/cache@v3
id: cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/scripts/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python Dependencies
run: |
pip install -r scripts/requirements.txt
- name: Fetch the Latest Release Data
id: fetch_release
env:
VAULT_TOKEN: ${{ secrets.VAULT_TOKEN }}
TOKEN_VALHALLA: ${{ secrets.TOKEN_VALHALLA }}
run: |
npx dotenv-vault@latest pull development -y --dotenvMe=${{ secrets.VAULT_TOKEN }}
source .env
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${TOKEN_VALHALLA}" \
https://api.github.com/repos/${{ github.repository }}/releases/latest \
-o $GITHUB_WORKSPACE/release_metadata.json
- name: Update Gist File
run: |
npx dotenv-vault@latest pull development -y --dotenvMe=${{ secrets.VAULT_TOKEN }}
source .env
echo "GIST_ID=$GIST_ID"
python scripts/release_metadata.py \
--gist-id $GIST_ID \
--actor ${{ github.actor }} \
--file-content "$(cat $GITHUB_WORKSPACE/release_metadata.json)"