Skip to content

Merge branch 'main' of https://github.com/bmlt-enabled/bmlt-workflow #98

Merge branch 'main' of https://github.com/bmlt-enabled/bmlt-workflow

Merge branch 'main' of https://github.com/bmlt-enabled/bmlt-workflow #98

Workflow file for this run

name: 'latest'
on:
push:
branches: [ 'main' ]
jobs:
tests:
runs-on: ubuntu-latest
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 }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
id: install-dependencies
uses: php-actions/composer@v5
with:
php_version: 8.0
args: --prefer-dist --no-progress --no-suggest
- name: PHP Unit Test
id: php-unit-test
uses: php-actions/phpunit@v3
with:
php_version: 8.0.27
version: 9.5.21
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#wordpress-bmlt-workflow'
if: failure()
package:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
# needs: [ tests ] # tmp let job run if tests fail
steps:
- uses: actions/checkout@v2
id: code-checkout
- name: Build package
id: build-package
run: |
export ARTIFACT_FILE=bmlt-workflow-${GITHUB_RUN_NUMBER}-${GITHUB_SHA}
export ARTIFACT_FILENAME=${ARTIFACT_FILE}.zip
echo "ARTIFACT_FILENAME=${ARTIFACT_FILENAME}" >> $GITHUB_ENV
git archive --format=zip --output=${ARTIFACT_FILENAME} HEAD
echo ${GITHUB_SHA} > build.txt
zip ${ARTIFACT_FILENAME} build.txt
mkdir artifacts/
mv ${ARTIFACT_FILENAME} artifacts/
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions/gh-ci-s3-artifact
role-session-name: gh-actions-bmlt-workflow
aws-region: us-east-1
- name: copy artifact to s3
run: |
aws s3 cp artifacts/${ARTIFACT_FILENAME} s3://${{ secrets.S3_BUCKET }}/bmlt-workflow/${ARTIFACT_FILENAME}
- name: Publish Release to Latest WP 🎉
id: publish_latest
uses: bmlt-enabled/[email protected]
with:
file: artifacts/${{ env.ARTIFACT_FILENAME }}
s3_key: bmlt-workflow
aws_account_id: ${{ secrets.AWS_ACCOUNT_ID }}
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#wordpress-bmlt-workflow'
if: failure()