Merge pull request #274 from bmlt-enabled/feature/mayo-251-add-displa… #202
This file contains hidden or 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: 'latest' | |
| on: | |
| push: | |
| branches: [ 'main' ] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| steps: | |
| - name: Check out code 🛒 | |
| uses: actions/checkout@v6 | |
| - name: Setup PHP 🐫 | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.2 | |
| - name: PHPCS checker 🧹 | |
| id: php-codesniffer | |
| run: make lint | |
| deploy: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| id-token: write | |
| contents: write | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| S3_BUCKET: archives.bmlt.app | |
| S3_KEY: mayo-events-manager | |
| BUILD_DIR: build | |
| DIST_DIR_S3: dist/s3 | |
| PLUGIN: "mayo-events-manager" | |
| needs: [ lint ] | |
| steps: | |
| - name: Check out code 🛒 | |
| uses: actions/checkout@v6 | |
| id: code-checkout | |
| - name: Install gettext (for msgfmt) 🌐 | |
| run: sudo apt-get update && sudo apt-get install -y --no-install-recommends gettext | |
| - name: Prepare to deploy 🔧 | |
| run: | | |
| export FILENAME=${PLUGIN}-build-${GITHUB_RUN_NUMBER}-${GITHUB_SHA} | |
| export ZIP_FILENAME=$FILENAME.zip | |
| echo "ZIP_FILENAME=${ZIP_FILENAME}" >> $GITHUB_ENV | |
| PROD=1 make build | |
| mkdir -p ${DIST_DIR_S3} && cp ${BUILD_DIR}/${ZIP_FILENAME} ${DIST_DIR_S3}/${ZIP_FILENAME} | |
| - name: configure aws credentials 🪪 | |
| uses: aws-actions/configure-aws-credentials@v5 | |
| with: | |
| role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions/gh-ci-s3-artifact | |
| role-session-name: gh-actions-${{ env.PLUGIN }} | |
| aws-region: us-east-1 | |
| - name: copy artifact to s3 🪣 | |
| run: | | |
| aws s3 cp $DIST_DIR_S3/$ZIP_FILENAME s3://$S3_BUCKET/$S3_KEY/$ZIP_FILENAME | |
| - name: Publish Release to Latest WP 🎉 | |
| id: publish_latest | |
| uses: bmlt-enabled/wordpress-releases-github-action@v1.3 | |
| with: | |
| file: ${{ env.DIST_DIR_S3 }}/${{ env.ZIP_FILENAME }} | |
| s3_key: ${{ env.S3_KEY }} | |
| aws_account_id: ${{ secrets.AWS_ACCOUNT_ID }} |