Skip to content

Update slm-plus.php #29

Update slm-plus.php

Update slm-plus.php #29

Workflow file for this run

name: Build and Upload Release Asset
on:
push:
tags:
- '*' # Runs on any tag push
release:
types:
- published # Runs when a release is published
workflow_dispatch: # Allows manual triggering
permissions:
contents: write # Required to upload assets
actions: write # Required for actions to work correctly
id-token: write # Required for authentication if necessary
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout code
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Set up Node.js (if needed)
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '23'
# Step 3: Create a build directory and copy necessary files
- name: Prepare build directory
run: |
mkdir build
rsync -av --progress . build/slm-plus --exclude-from=<(echo "
.gitignore
.changelog.md
security.md
_config.yml
composer.json
build.xml
package.json
package-lock.json
.github
.vscode
samples
")
# Step 4: Create the ZIP file
- name: Create ZIP archive
run: |
cd build
zip -r ../slm-plus.zip slm-plus
shell: bash
# Step 5: Create a Release (if push event)
- name: Create a Release (if push)
if: github.event_name == 'push'
run: |
TAG_NAME=$(echo $GITHUB_REF | sed 's/refs\/tags\///')
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d '{"tag_name": "'$TAG_NAME'", "name": "'$TAG_NAME'"}' \
https://api.github.com/repos/${{ github.repository }}/releases
# Step 6: Upload ZIP to Release (only if release is published)
- name: Upload ZIP to Release
if: github.event_name == 'release' && github.event.action == 'published'
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: slm-plus.zip
asset_name: slm-plus.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Ensure token is passed correctly