Skip to content

Commit b77574d

Browse files
chore: add gh release to workflow (#150)
1 parent 2537787 commit b77574d

File tree

1 file changed

+35
-22
lines changed

1 file changed

+35
-22
lines changed

.github/workflows/test-and-deploy.yml

+35-22
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test
1+
name: Test and Deploy
22
on:
33
push:
44
branches: [ '*' ]
@@ -21,42 +21,55 @@ jobs:
2121
dependencies:
2222
- "lowest"
2323
- "highest"
24-
2524
steps:
26-
- name: Checkout php-http-client
27-
uses: actions/checkout@v2
25+
- name: Checkout php-http-client
26+
uses: actions/checkout@v2
27+
28+
- name: Setup PHP Action
29+
uses: shivammathur/[email protected]
30+
with:
31+
php-version: ${{ matrix.php }}
32+
id: php
33+
34+
- name: Composer webhook config
35+
run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
2836

29-
- name: Setup PHP Action
30-
uses: shivammathur/[email protected]
31-
with:
32-
php-version: ${{ matrix.php }}
33-
id: php
37+
- name: Install dependencies
38+
run: composer install
3439

35-
- name: Composer webhook config
36-
run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
40+
- name: Update Dependencies
41+
if: ${{ matrix.dependencies == 'lowest' }}
42+
run: composer update --prefer-lowest --prefer-stable -n
3743

38-
- name: Install dependencies
39-
run: composer install
44+
- name: Run Tests
45+
run: make test
4046

41-
- name: Update Dependencies
42-
if: ${{ matrix.dependencies == 'lowest' }}
43-
run: composer update --prefer-lowest --prefer-stable -n
47+
deploy:
48+
name: Deploy
49+
if: success() && github.ref_type == 'tag'
50+
needs: [ test ]
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Checkout php-http-client
54+
uses: actions/checkout@v2
4455

45-
- name: Run Tests
46-
run: make test
56+
- name: Create GitHub Release
57+
uses: sendgrid/dx-automator/actions/release@main
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4760

4861
notify-on-failure:
4962
name: Slack notify on failure
50-
if: ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
51-
needs: [test]
63+
if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
64+
needs: [ test, deploy ]
5265
runs-on: ubuntu-latest
5366
steps:
5467
- uses: rtCamp/action-slack-notify@v2
5568
env:
5669
SLACK_COLOR: failure
5770
SLACK_ICON_EMOJI: ':github:'
58-
SLACK_MESSAGE: ${{ format('Build {2} in {1} failed{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }}
59-
SLACK_TITLE: Build Failure
71+
SLACK_MESSAGE: ${{ format('Tests *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }}
72+
SLACK_TITLE: Action Failure - ${{ github.repository }}
6073
SLACK_USERNAME: GitHub Actions
6174
SLACK_MSG_AUTHOR: twilio-dx
6275
SLACK_FOOTER: Posted automatically using GitHub Actions

0 commit comments

Comments
 (0)