From 741504f698ea24b6f65d0f9ef1c6c6c735328e51 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 24 Aug 2025 20:59:46 +1200 Subject: [PATCH] Update .gitea/workflows/test-and-publish.yaml --- .gitea/workflows/manual-publish.yaml | 84 ++++++++++++++++++++++++++ .gitea/workflows/test-and-publish.yaml | 3 +- 2 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 .gitea/workflows/manual-publish.yaml diff --git a/.gitea/workflows/manual-publish.yaml b/.gitea/workflows/manual-publish.yaml new file mode 100644 index 0000000..b391ce2 --- /dev/null +++ b/.gitea/workflows/manual-publish.yaml @@ -0,0 +1,84 @@ +name: Manual Publish Templates + +on: + workflow_dispatch: + inputs: + templates: + description: 'Templates to publish (space-separated, or "all")' + required: false + default: 'all' + type: string + bump_version: + description: 'Bump version type (major, minor, patch, or none)' + required: false + default: 'none' + type: choice + options: + - none + - patch + - minor + - major + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install dependencies + run: | + # Install sos tool for uploading + curl -o /tmp/sos https://getbin.xyz/sos:latest && chmod +x /tmp/sos + sudo mv /tmp/sos /usr/local/bin/sos + + # Install jq for JSON parsing + which jq || sudo apt-get update && sudo apt-get install -y jq + + # Install tar for packaging + which tar || sudo apt-get update && sudo apt-get install -y tar + + - name: Bump versions if requested + if: inputs.bump_version != 'none' + run: | + chmod +x bump-version.sh + if [ "${{ inputs.templates }}" == "all" ]; then + ./bump-version.sh --all ${{ inputs.bump_version }} + else + for template in ${{ inputs.templates }}; do + ./bump-version.sh "$template" ${{ inputs.bump_version }} + done + fi + + # Show updated versions + echo "Updated versions:" + cat versions.json + + - name: Run tests + run: | + chmod +x test.sh + ./test.sh + + - name: Publish templates + run: | + chmod +x publish.sh + + if [ "${{ inputs.templates }}" == "all" ]; then + SOS_WRITE_TOKEN=${{ secrets.SOS_WRITE_TOKEN }} \ + ./publish.sh --all + else + SOS_WRITE_TOKEN=${{ secrets.SOS_WRITE_TOKEN }} \ + ./publish.sh ${{ inputs.templates }} + fi + + - name: Commit version changes + if: inputs.bump_version != 'none' + run: | + git config --local user.email "actions@gitea.com" + git config --local user.name "Gitea Actions" + git add versions.json + git diff --staged --quiet || git commit -m "chore: bump version(s) via manual publish" + git push \ No newline at end of file diff --git a/.gitea/workflows/test-and-publish.yaml b/.gitea/workflows/test-and-publish.yaml index ffeda9f..75f346c 100644 --- a/.gitea/workflows/test-and-publish.yaml +++ b/.gitea/workflows/test-and-publish.yaml @@ -51,11 +51,10 @@ jobs: - name: Publish changed templates if: github.ref == 'refs/heads/main' && github.event_name == 'push' && steps.changes.outputs.changed == 'true' - env: - SOS_WRITE_TOKEN: ${{ secrets.SOS_WRITE_TOKEN }} run: | chmod +x publish.sh # Publish only changed templates + SOS_WRITE_TOKEN=${{ secrets.SOS_WRITE_TOKEN }} \ ./publish.sh --changed-only - name: Update versions after successful publish