0.0.42 #47
Workflow file for this run
This file contains 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: Generate ZIP for Release | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
attestations: write | |
contents: write | |
id-token: write | |
timeout-minutes: 70 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Build PHP | |
run: composer install --no-dev --optimize-autoloader | |
- uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: latest | |
- name: Install Packages w/ Bun | |
run: bun install | |
- name: Build with Bun | |
run: bun run build | |
- name: Create Release ZIP | |
uses: thedoctor0/zip-release@master | |
with: | |
type: 'zip' | |
filename: 'frames-integration-for-farcaster.zip' | |
exclusions: '/*node_modules/* readme.md package.json bin/ bin/* tests/ tests/* tests/helpers/ tests/helpers/* tests/unit/ tests/unit/* .gitignore .eslintrc.js .nvmrc .stylelintrc.json phpcs.xml tsconfig.json bun.lockb .vscode/ .vscode/* .wordpress-org/ .wordpress-org/* src/ src/* src/admin-components/ src/admin-components/* src/editor/ src/editor/* src/admin-utils/ src/admin-utils/* src/components/ src/components/* src/admin-hooks/ src/admin-hooks/* src/utils/ src/utils/* /*.git/* /*.github/* phpunit.xml' | |
- name: Unzip Folder for WP.org | |
uses: montudor/action-zip@v1 | |
with: | |
args: unzip -qq frames-integration-for-farcaster.zip -d frames-integration-for-farcaster | |
- name: Upload Plugin to WP.org | |
id: deploy | |
uses: 10up/action-wordpress-plugin-deploy@2.2.2 | |
env: | |
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} | |
SVN_USERNAME: ${{ secrets.SVN_USERNAME }} | |
SLUG: frames-integration-for-farcaster | |
BUILD_DIR: ./frames-integration-for-farcaster | |
# This fetches the zipped plugin from w.org. The zip might not exist yet if the plugin uses release confirmation | |
# and the release hasn't been confirmed. This will retry until the zip is available or the timeout is reached. | |
# Based on action by John Billion. | |
- name: Fetch ZIP from WordPress.org | |
run: | #shell | |
zipurl="https://downloads.wordpress.org/plugin/frames-integration-for-farcaster.${{ github.ref_name }}.zip" | |
echo "Fetching plugin ZIP from $zipurl ..." | |
elapsed=0 | |
sleep=20 | |
per_minute=$((60 / $sleep)) | |
max_retries=$(( 60 * $per_minute )) | |
while [ $elapsed -lt $max_retries ]; do | |
# Perform a HEAD request to check if the ZIP is available | |
status_code=$(curl -s -o /dev/null -w "%{http_code}" -I "$zipurl") | |
if [ "$status_code" -eq 200 ]; then | |
curl -s -o frames-integration-for-farcaster.${{ github.ref_name }}.zip "$zipurl" | |
break | |
else | |
echo "Plugin ZIP not available yet (HTTP status $status_code), retrying in $sleep seconds..." | |
sleep $sleep | |
elapsed=$((elapsed + 1)) | |
fi | |
done | |
if [ $elapsed -ge $max_retries ]; then | |
echo "Error: 60 minute timeout reached. Plugin ZIP not available." | |
exit 1 | |
fi | |
shell: bash | |
# Now compare the contents of the generated zip and the w.org zip to ensure they match. Only then can we attest the w.org zip. | |
- name: Unzip frames-integration-for-farcaster.${{ github.ref_name }}.zip from WordPress.org | |
run: | #shell | |
unzip -q -d zip-org frames-integration-for-farcaster.${{ github.ref_name }}.zip | |
shell: bash | |
- name: Unzip the Generated Zip | |
run: | #shell | |
unzip -q -d zip-generated "frames-integration-for-farcaster.zip" | |
shell: bash | |
- name: Ensure the Directories are Identical | |
run: | #shell | |
diff -r zip-generated zip-org/frames-integration-for-farcaster | |
shell: bash | |
- name: Generate Attestation for the Plugin | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: "frames-integration-for-farcaster.${{ github.ref_name }}.zip" | |
subject-name: "wordpress.org-frames-integration-for-farcaster-${{ github.ref_name }}" | |
- name: Check the Attestation | |
run: | #shell | |
gh attestation verify frames-integration-for-farcaster.${{ github.ref_name }}.zip --repo "${{ github.repository }}" | |
shell: bash | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: frames-integration-for-farcaster.${{ github.ref_name }}.zip | |
path: frames-integration-for-farcaster.${{ github.ref_name }}.zip | |
- name: Upload to Release | |
run: gh release upload ${{ github.event.release.tag_name }} frames-integration-for-farcaster.${{ github.ref_name }}.zip | |
env: | |
GITHUB_TOKEN: ${{ github.TOKEN }} |