Newer
Older
---
name: Build release
on: # yamllint disable-line rule:truthy
push:
tags:
- '*'
jobs:
build:
name: Build release
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
matrix:
version: ['slim', 'full']
steps:
- name: Setup PHP, with composer and extensions
id: setup-php
# https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
# Should match the minimum required version for SimpleSAMLphp
tools: composer:v2, phive
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
# Store the version, stripping any v-prefix
- name: Write release version
run: |
Tim van Dijen
committed
{
echo "TAG=${{ github.ref_name }}"
echo "VERSION=${TAG#v}"
echo "COMPOSER_VERSION=$(composer config version)"
} >> "$GITHUB_ENV"
- name: Validate composer.json and composer.lock
run: composer validate
- name: Make sure a version is set in composer.json that matches the tag
run: exit 1
- name: Install Composer dependencies
run: composer install --no-progress --no-dev --prefer-dist --optimize-autoloader
- name: Install SimpleSAMLphp modules
env:
FILE: ".github/build/${{ matrix.version }}.json"
run: |
for k in $(jq '.modules | keys | .[]' "$FILE"); do
module=$(jq -r ".modules[$k]" "$FILE");
if [ -n "$module" ];
then
repository=$(jq -r '.repository' <<< "$module");
v=$(jq -r '.version' <<< "$module");
composer require "$repository:$v" --update-no-dev --ignore-platform-reqs
fi
done
- name: Add composer.phar to the release
run: phive --no-progress install --trust-gpg-keys CBB3D576F2A0946F --copy --target ./bin composer
grep export-ignore .gitattributes | cut -d ' ' -f 1 | while IFS= read -r line
done
rm -rf .git
- name: Build tarball
run: |
cd ..
Tim van Dijen
committed
TARGET="/tmp/simplesamlphp-$VERSION-${{ matrix.version }}.tar.gz"
# remove -slim from the filename for our minimalistic build
TARGET=${TARGET/-slim/}
echo "VERSION=$TARGET" >> "$GITHUB_ENV"
tar --owner 0 --group 0 -cvzf "$TARGET" "simplesamlphp-$VERSION"
Tim van Dijen
committed
path: "$TARGET"
- name: Calculate SHA checksum (${{ matrix.version }})
Tim van Dijen
committed
run: sha256sum "$TARGET"
Tim van Dijen
committed
- name: Run website build
if: |
startsWith(github.ref, 'refs/tags/v') &&
contains(github.ref, 'alpha') != true &&
contains(github.ref, 'beta') != true
Tim van Dijen
committed
with:
# Token has to be generated on a user account that controls the docs-repository.
# The _only_ scope to select is "Access public repositories", nothing more.
github-token: ${{ secrets.PAT_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'simplesamlphp',
repo: 'simplesamlphp.github.io',
workflow_id: 'github-pages.yml',
ref: 'release'
})