Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 33 additions & 8 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,54 @@ jobs:
name: "Publish release"
runs-on: "ubuntu-latest"
container:
image: "ghcr.io/glpi-project/plugin-builder"
image: "ghcr.io/glpi-project/githubactions-glpi-apache:latest"
options: --user 1001 # using built-in image user, otherwise GitHub Actions can't write file to the container
steps:
- name: "Checkout"
- name: "Checkout setup.php"
uses: "actions/checkout@v6"
with:
ref: "${{ inputs.tag }}"
sparse-checkout: setup.php
path: tmp_setup
- name: "Get Plugin Key"
run: |
PLUGIN_KEY=$(sed --quiet 's/.*function plugin_version_\([a-z0-9_]\+\).*/\1/p' tmp_setup/setup.php | head --lines=1)
if [ -z "$PLUGIN_KEY" ]; then
echo "Could not extract plugin key from setup.php"
exit 1
fi
echo "PLUGIN_KEY=$PLUGIN_KEY" >> $GITHUB_ENV
- name: "Checkout Plugin"
uses: "actions/checkout@v6"
with:
ref: "${{ inputs.tag }}"
fetch-tags: true
fetch-depth: 0
path: plugins/${{ env.PLUGIN_KEY }}
- name: "Link Plugin to GLPI"
run: |
sudo ln -s $GITHUB_WORKSPACE/plugins/$PLUGIN_KEY /var/www/glpi/plugins/$PLUGIN_KEY
# Fix permissions for logs and other writable dirs
sudo mkdir -p /var/www/glpi/tests/files/_log
sudo chmod -R 777 /var/www/glpi/
# Ensure git trusts the directory
git config --global --add safe.directory '*'
- name: "Build release archive"
working-directory: /var/www/glpi/
run: |
composer install --no-progress --no-suggest --no-interaction --prefer-dist
git config --global --add safe.directory $(pwd)
vendor/bin/plugin-release --assume-yes --dont-check --nogithub --nosign --release "${{ inputs.tag }}" --verbose
echo "PACKAGE_BASENAME=$(find "$(pwd)/dist/" -type f -name '*.tar.bz2' | xargs -n 1 basename)" >> $GITHUB_ENV
echo "PACKAGE_PATH=$(find "$(pwd)/dist/" -type f -name '*.tar.bz2')" >> $GITHUB_ENV
php bin/console tools:plugin:release --plugin=${{ env.PLUGIN_KEY }} --no-interaction --force --verbose
echo "PACKAGE_BASENAME=$(find "plugins/${{ env.PLUGIN_KEY }}/dist/" -type f -name '*.tar.bz2' | xargs --max-args=1 basename)" >> $GITHUB_ENV
echo "PACKAGE_PATH=$(find "/var/www/glpi/plugins/${{ env.PLUGIN_KEY }}/dist/" -type f -name '*.tar.bz2')" >> $GITHUB_ENV
- name: "Compute values"
working-directory: /var/www/glpi/plugins/${{ env.PLUGIN_KEY }}/
run: |
TAG_NAME="${{ inputs.tag }}"
RELEASE_NAME="${{ inputs.release-name }}"
RELEASE_BODY="${{ inputs.release-body }}"
if [[ -z "${RELEASE_BODY}" && -f "CHANGELOG.md" ]]; then
RELEASE_BODY="See [CHANGELOG.md](CHANGELOG.md) for changes details."
fi
if [[ $( echo ${TAG_NAME} | grep -E "\-(alpha|beta|rc)[0-9]*$" ) ]]; then
if [[ $( echo ${TAG_NAME} | grep --extended-regexp "\-(alpha|beta|rc)[0-9]*$" ) ]]; then
PRERELEASE="true"
else
PRERELEASE="false"
Expand Down