Skip to content

backporting retry logic #82

backporting retry logic

backporting retry logic #82

Workflow file for this run

name: 'release'
on:
push:
tags: [ '*' ]
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
php:
- "8.0"
- "8.1"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- uses: actions/checkout@v2
id: code-checkout
- name: Validate composer.json and composer.lock
id: composer-validate
run: composer validate
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-lint-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-lint-php-${{ matrix.php }}-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
id: install-dependencies
uses: php-actions/composer@v5
with:
php_version: ${{ matrix.php }}
args: --prefer-dist --no-progress --no-suggest
- name: PHPCS checker
id: php-codesniffer
run: vendor/squizlabs/php_codesniffer/bin/phpcs
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#yap'
if: failure()
create_release:
runs-on: ubuntu-latest
needs: [ lint ]
name: Create release
permissions:
contents: write
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v2
id: code-checkout
- name: Generate release notes
id: generate_release_notes
run: |
curl -LO https://raw.githubusercontent.com/bmlt-enabled/release-notes-tool/master/gh-release-notes.sh
chmod +x gh-release-notes.sh
./gh-release-notes.sh RELEASENOTES.md "###"
RELEASE_TYPE=$(if [[ "$GITHUB_REF_NAME" =~ "beta" ]]; then echo "true"; else echo "false"; fi)
echo "RELEASE_TYPE=${RELEASE_TYPE}" >> $GITHUB_ENV
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: "changelog.txt"
prerelease: ${{ env.RELEASE_TYPE }}
package:
runs-on: ubuntu-latest
strategy:
matrix:
php:
- "8.0"
needs: [ lint, create_release ]
steps:
- uses: actions/checkout@v2
id: code-checkout
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
id: install-dependencies
uses: php-actions/composer@v5
with:
php_version: ${{ matrix.php }}
args: --prefer-dist --no-dev --no-progress --no-suggest
- name: Build package
id: build-package
run: |
export ARTIFACT_FILE=yap-${GITHUB_REF##*/}
export ARTIFACT_FILENAME=${ARTIFACT_FILE}.zip
git archive --format=zip --output=${ARTIFACT_FILENAME} --prefix=${ARTIFACT_FILE}/ HEAD
DISABLE_NOTIFIER=true make deploy
unzip ${ARTIFACT_FILENAME}
rm ${ARTIFACT_FILENAME}
echo ${GITHUB_SHA} > ${ARTIFACT_FILE}/build.txt
cp -R vendor ${ARTIFACT_FILE}/
mkdir -p ${ARTIFACT_FILE}/public/dist && cp -R public/dist/. ${ARTIFACT_FILE}/public/dist
find ./${ARTIFACT_FILE} -type d | xargs chmod 755
find ./${ARTIFACT_FILE} -name '*.php' | xargs chmod 644
zip -r -9 ${ARTIFACT_FILENAME} ${ARTIFACT_FILE}
curl -LO https://raw.githubusercontent.com/bmlt-enabled/release-notes-tool/master/gh-release-notes.sh
chmod +x gh-release-notes.sh
./gh-release-notes.sh RELEASENOTES.md "###"
- name: Prepare artifact metadata
id: prepare_artifact_metadata
run: |
echo ::set-output name=ARTIFACT_PATH::./yap-${GITHUB_REF##*/}.zip
echo ::set-output name=ARTIFACT_NAME::yap-${GITHUB_REF##*/}.zip
- name: Upload Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ steps.prepare_artifact_metadata.outputs.ARTIFACT_PATH }}
asset_name: ${{ steps.prepare_artifact_metadata.outputs.ARTIFACT_NAME }}
asset_content_type: application/zip
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#yap'
if: failure()