Deploy to Pronamic WordPress directory #16
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: Deploy to Pronamic WordPress directory | |
on: | |
workflow_dispatch: | |
inputs: | |
latest: | |
default: true | |
type: boolean | |
description: 'Deploy as "Latest"' | |
slug: | |
default: 'pronamic-pay-with-mollie-for-gravity-forms' | |
type: string | |
version: | |
description: 'Version to deploy to Pronamic WordPress directory' | |
required: true | |
type: string | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: | |
name: Pronamic WordPress directory | |
url: https://wp.pronamic.directory/plugins/pronamic-pay-with-mollie-for-gravity-forms/ | |
permissions: | |
id-token: 'write' | |
env: | |
FILENAME: ${{ inputs.slug }}.${{ inputs.version }}.zip | |
steps: | |
- name: 'Download GitHub release plugin ZIP file' | |
run: | | |
gh release download v${{ inputs.version }} --repo ${{ github.repository }} --pattern ${{ env.FILENAME }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- id: 'auth' | |
name: 'Authenticate to Google Cloud' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
project_id: 'pronamic-downloads' | |
workload_identity_provider: 'projects/623467151959/locations/global/workloadIdentityPools/github/providers/my-repo' | |
- name: 'Setup Google Cloud CLI' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: 'Upload to Cloud Storage' | |
run: 'gcloud storage cp ${{ env.FILENAME }} gs://wp.pronamic.download/plugins/${{ inputs.slug }}/${{ env.FILENAME }}' | |
- name: 'Set latest on Cloud Storage' | |
if: inputs.latest | |
run: 'gcloud storage cp gs://wp.pronamic.download/plugins/${{ inputs.slug }}/${{ env.FILENAME }} gs://wp.pronamic.download/plugins/${{ inputs.slug }}/${{ inputs.slug }}.zip' | |
- name: 'Set latest on Pronamic WordPress directory' | |
if: inputs.latest | |
run: 'curl --fail-with-body --user "pronamic:${{ secrets.WP_PRONAMIC_DIRECTORY_PASSWORD }}" --data "version=${{ inputs.version }}" --request PATCH https://wp.pronamic.directory/wp-json/pronamic-wp-extensions/v1/plugins/${{ inputs.slug }}' |