Skip to content

Stable

Stable #36

Workflow file for this run

name: Stable
on:
push:
tags:
- '*'
jobs:
# Builds the package and creates artifact with dist files
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none
- name: Install Composer dependencies
uses: "ramsey/composer-install@v2"
with:
composer-options: "--no-dev"
- name: Run Strauss
run: composer run-script prefix-namespaces-prod
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '16'
cache: yarn
- name: Install yarn dependencies
run: yarn install --immutable
- name: Build static assets
run: yarn build:production
- name: Create build dir
run: mkdir build
- name: Copy files
uses: Pendect/[email protected]
env:
DEPLOY_KEY: ${{ secrets.PACKAGES_DEPLOY_KEY }}
with:
flags: '-avq'
options: '--exclude-from=".build-excludes"'
src: '.'
dest: 'build'
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build
path: build
# Creates the stable package artifact when tag is created
pack:
name: Pack
runs-on: ubuntu-latest
needs: build
steps:
- name: Setup variables
id: vars
run: |
echo "::set-output name=package-name::${{ secrets.SLUG }}-${GITHUB_REF#refs/tags/}"
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build
path: ${{ secrets.SLUG }}
- name: Create archive
run: |
zip -rq ${{ steps.vars.outputs.package-name }}.zip ${{ secrets.SLUG }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.vars.outputs.package-name }}
path: ${{ steps.vars.outputs.package-name }}.zip
# Release on GitHub
github-release:
name: Release on GitHub
runs-on: ubuntu-latest
needs: pack
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup variables
id: vars
run: |
echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
echo "::set-output name=package-name::${{ secrets.SLUG }}-${GITHUB_REF#refs/tags/}"
- name: Parse changelog
run: |
START="= ${{ steps.vars.outputs.version }} ="
END="= [0-9]+.[0-9]+.[0-9]+ =|==|\$"
grep -oPz "(?s)${START}.*?\n\K.*?(?=${END})" readme.txt > changelog.txt
truncate -s-2 changelog.txt
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ steps.vars.outputs.package-name }}
path: .
- name: Release
uses: softprops/action-gh-release@v2
with:
body_path: changelog.txt
files: ${{ steps.vars.outputs.package-name }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}