mirror of
https://gh.wpcy.net/https://github.com/aspirepress/aspireupdate.git
synced 2026-07-17 09:56:36 +08:00
This workflow needs some more work as it's currently failing when pushing a tag. In the meantime, we'll manually update the version number in the `assets/playground/blueprint.json` file as part of our pre-release bump PRs.
49 lines
1.7 KiB
YAML
49 lines
1.7 KiB
YAML
name: Update Playground Blueprint with Repository and Branch
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
update-blueprint:
|
|
if: github.repository == 'aspirepress/aspireupdate'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Harden the runner (Audit all outbound calls)
|
|
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Set Branch or Tag Name
|
|
id: branch-name
|
|
run: |
|
|
if [ "${{ github.ref_type }}" == "branch" ]; then
|
|
echo "CURRENT_REF=${{ github.ref_name }}" >> $GITHUB_ENV
|
|
elif [ "${{ github.ref_type }}" == "tag" ]; then
|
|
echo "CURRENT_REF=${{ github.ref_name }}" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Update Blueprint JSON
|
|
run: |
|
|
jq --tab '.plugins[0] |= "https://github-proxy.com/proxy/?repo='$GITHUB_REPOSITORY'&branch='$CURRENT_REF'"' assets/playground/blueprint.json > assets/playground/blueprint.json.tmp
|
|
mv assets/playground/blueprint.json.tmp assets/playground/blueprint.json
|
|
|
|
- name: Commit and Push Changes
|
|
run: |
|
|
if git diff --cached --quiet; then
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add assets/playground/blueprint.json
|
|
git commit -m "Update blueprint.json for branch/tag ${{ env.name }}"
|
|
git push
|
|
fi
|
|
env:
|
|
name: ${{ env.name }}
|