satis-build #1019
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Satis Build via Webhook | |
on: | |
repository_dispatch: | |
types: | |
- 'satis-build' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.repository }}-build | |
cancel-in-progress: false | |
env: | |
VENDOR: ${{ github.event.client_payload.vendor }} | |
PACKAGE: ${{ github.event.client_payload.package }} | |
VERSION: ${{ github.event.client_payload.version }} | |
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.TOKEN }}"}}' | |
jobs: | |
satis-build: | |
name: Satis Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
coverage: none | |
tools: composer, cs2pr | |
- name: PHP version | |
run: php --version | |
- name: Validate Composer files | |
run: composer validate | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer vendor directory | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install PHP dependencies | |
run: composer install | |
- name: Checkout GitHub pages branch | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
path: ./dist | |
- name: Run Build | |
run: php -dmemory_limit=-1 vendor/bin/satis build --repository-url ${{ format('git@github.com:{0}/{1}.git', github.event.client_payload.vendor, github.event.client_payload.package) }} ./satis.json ./dist | |
- name: List files | |
run: ls -lah ./dist | |
- name: Commit web files | |
run: | | |
cd ./dist | |
git config --local user.name "Newfold WordPress Team" | |
git config --local user.email "wordpress-coe@newfold.com" | |
git remote -v | |
git add -A | |
git commit -m "Satis build triggered by release $VERSION of $VENDOR/$PACKAGE" | |
git status | |
cd - | |
- name: Push changes | |
uses: ad-m/github-push-action@v0.8.0 | |
with: | |
branch: gh-pages | |
directory: ./dist | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Repository Dispatch | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
event-type: 'package-released' | |
client-payload: >- | |
{ | |
"vendor": "$VENDOR", | |
"package": "$PACKAGE", | |
"version": "$VENDOR" | |
} | |
- name: Send message to ms teams | |
uses: dhollerbach/actions.send-message-to-ms-teams@1.0.10 | |
with: | |
webhook: '${{ secrets.INCOMING_WEBHOOK_URL }}' | |
message: "Release ${{ github.event.client_payload.version }} of ${{ github.event.client_payload.vendor }}/${{ github.event.client_payload.package }} on satis is complete!\nVisit https://newfold-labs.github.io/satis/" |