Skip to content

Build, tag and attach releases #73

Build, tag and attach releases

Build, tag and attach releases #73

Workflow file for this run

name: Build, tag and attach releases
on:
release:
types: [published]
jobs:
create-phar:
runs-on: ubuntu-latest
name: Create Strauss phar on new release
steps:
- name: Git checkout
uses: actions/checkout@v2
with:
ref: master
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: Install dependencies
run: composer install --no-dev --prefer-dist --no-progress
- name: "Edit `strauss/bin/strauss` to update the version number"
env:
CURRENT_RELEASE: ${{ github.event.release.tag_name }}
run: |
find bin -name 'strauss' -exec sed -i "s/}, '[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*');/}, '$CURRENT_RELEASE');/" {} +
- name: Commit updated README.md
uses: stefanzweifel/[email protected]
with:
branch: master
file_pattern: "bin/strauss"
commit_message: "🤖 Update version number in bin"
- name: Create .phar
run: |
wget -O phar-composer.phar https://github.com/clue/phar-composer/releases/download/v1.4.0/phar-composer-1.4.0.phar
mkdir build
mv vendor build/vendor
mv src build/src
mv bin build/bin
mv composer.json build
php -d phar.readonly=off phar-composer.phar build ./build/
- name: Test run strauss
run: php strauss.phar --version
- name: Check version
run: |
TAG_NAME="${{ github.event.release.tag_name }}"
CURRENT_VERSION="$(php strauss.phar --version | sed -e 's#^.\+ \([0-9.]\+\)$#\1#')"
if [ "${TAG_NAME#v}" != "${CURRENT_VERSION}" ]; then
echo "::error::Latest tag differs from current version"
exit 10
fi
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Sign the PHAR
run: |
ls strauss.phar
gpg --local-user [email protected] \
--batch \
--yes \
--passphrase="${{ secrets.PASSPHRASE }}" \
--detach-sign \
--output strauss.phar.asc \
strauss.phar
- uses: meeDamian/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
strauss.phar
strauss.phar.asc
gzip: false
allow_override: true