-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (48 loc) · 1.92 KB
/
deploy-to-wp-pronamic-directory.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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'
run: |
gh release download v${{ inputs.version }} --repo ${{ github.repository }} --pattern ${{ env.FILENAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: 'auth'
uses: 'google-github-actions/auth@v2'
with:
project_id: 'pronamic-downloads'
workload_identity_provider: 'projects/623467151959/locations/global/workloadIdentityPools/github/providers/my-repo'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
- name: 'Use gcloud CLI'
run: 'gcloud info'
- name: 'Upload'
run: 'gcloud storage cp ${{ env.FILENAME }} gs://wp.pronamic.download/plugins/${{ inputs.slug }}/${{ env.FILENAME }}'
- name: 'Copy latest'
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'
if: inputs.latest
run: 'curl --netrc --data "version=${{ inputs.version }}" --request PATCH https://wp.pronamic.directory/wp-json/pronamic-wp-extensions/v1/plugins/${{ inputs.slug }}