Skip to content

Commit b91968e

Browse files
Added change distribution workflow for package.
@FredDominant, kindly review these changes and test them. We need to make sure that the automation works.
1 parent 421d3ec commit b91968e

File tree

1 file changed

+45
-22
lines changed

1 file changed

+45
-22
lines changed

.github/workflows/package-publish.yml

+45-22
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,59 @@
1-
2-
name: Publish to Pub.dev
1+
name: Publish changes to Pub.dev
32

43
on:
5-
push:
6-
branched: ['master']
4+
release:
5+
types: [created]
76

87
jobs:
9-
version:
10-
name: Code Checks
8+
check-readme-and-changelog:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: checkout code
12+
uses: actions/checkout@v2
13+
14+
- name: check for changes in readme and changelog files
15+
run: |
16+
if ! git diff --quiet HEAD~ HEAD -- README.md CHANGELOG.md; then
17+
echo "README and/or CHANGELOG have been modified. Proceeding with deployment."
18+
else
19+
echo "README and/or CHANGELOG have not been modified. Terminating deployment."
20+
exit 1
21+
fi
22+
23+
- name: push build status to slack
24+
uses: 8398a7/action-slack@v3
25+
with:
26+
status: ${{ job.status }}
27+
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest
28+
env:
29+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
30+
MATRIX_CONTEXT: ${{ toJson(matrix) }}
31+
if: always()
32+
33+
publish:
34+
needs: check-readme-and-changelog
1135
runs-on: ubuntu-latest
1236
steps:
13-
- uses: actions/checkout@v2
14-
- name: set up flutter environment
37+
- name: checkout code
38+
uses: actions/checkout@v2
39+
40+
- name: setup flutter environment
1541
uses: subosito/flutter-action@v2
1642
with:
1743
flutter-version: '3.0.0'
1844

19-
- name: Install dependencies
45+
- name: install flutter dependencies
2046
run: flutter pub get
2147

22-
- name: Run unit tests
23-
run: flutter test --coverage
24-
25-
# - name: Publish to Pub.dev
26-
# run: pub publish --dry-run
48+
- name: Publish to Pub.dev
49+
run: pub publish --dry-run
2750

2851
- name: push build status to Slack
29-
uses: 8398a7/action-slack@v3
30-
with:
31-
status: ${{ job.status }}
32-
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest
33-
env:
34-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
35-
if: always()
36-
52+
uses: 8398a7/action-slack@v3
53+
with:
54+
status: ${{ job.status }}
55+
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest
56+
env:
57+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
58+
MATRIX_CONTEXT: ${{ toJson(matrix) }}
59+
if: always()

0 commit comments

Comments
 (0)