-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (77 loc) · 2.62 KB
/
Copy pathrelease.yaml
File metadata and controls
90 lines (77 loc) · 2.62 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Build and publish plugin
on:
release:
types:
- published
permissions:
contents: write
id-token: write
packages: write
statuses: write
jobs:
deploy:
name: Organic Wordpress Plugin - Build & Publish Package
runs-on: ubuntu-latest
env:
AWS_REGION: us-west-2
AWS_BUCKET: empire-wordpress-plugin
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
BUILD_NUMBER: ${{ github.event.release.tag_name }}
steps:
- uses: voxmedia/github-action-slack-notify-build@v1
id: slack
with:
channel: dev-notifications
status: STARTED
color: warning
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP with composer
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: zip
tools: composer
- name: Build plugin
run: ./build-zip.sh ${{ env.BUILD_NUMBER }}
# Configure AWS credentials
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-session-name: GitHub_to_AWS_via_FederatedOIDC
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT }}:role/GitHubActionIAMRole
aws-region: ${{ env.AWS_REGION }}
- name: Upload plugin to GitHub Release Archive
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'build/organic.zip'
- name: Upload plugin to S3
run: |
aws s3 cp build/organic-${{ env.BUILD_NUMBER }}.zip s3://${{ env.AWS_BUCKET }}/organic-latest.zip
aws s3api put-object-acl --bucket ${{ env.AWS_BUCKET }} --key organic-latest.zip --acl public-read
# Pre-configured step to send notification on build success
- name: Notify slack success
if: success()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
message_id: ${{ steps.slack.outputs.message_id }}
channel: dev-notifications
status: SUCCESS
color: good
# Pre-configured step to send notification on build failure
- name: Notify slack fail
if: failure()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
message_id: ${{ steps.slack.outputs.message_id }}
channel: dev-notifications
status: FAILED
color: danger