-
Notifications
You must be signed in to change notification settings - Fork 51
93 lines (85 loc) · 3.09 KB
/
continuous_deployment.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
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
91
92
93
name: Master Release
run-name: "Master Release"
on:
push:
branches:
- 'master'
jobs:
determine-if-deploy:
runs-on: ubuntu-latest
outputs:
deploy: ${{ steps.tag_exists.outputs.exists == 'false' }}
version: ${{ steps.latest_version.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
python-version: "3.11"
- name: Install Changelogger
run: pip install changelogged==0.11.3
- name: Get Latest Version
id: latest_version
run: |
VERSION=$(changelogger versions --latest)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- uses: mukunku/[email protected]
id: tag_exists
with:
tag: ${{ steps.latest_version.outputs.version }}
github-tag-and-release:
runs-on: ubuntu-latest
needs: determine-if-deploy
if: needs.determine-if-deploy.outputs.deploy == 'true'
env:
ZIP_FILE_NAME: klaviyo_reclaim-${{ needs.determine-if-deploy.outputs.version }}.zip
steps:
- uses: actions/checkout@v3
- name: Setup Python 3.11
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install Changelogger
run: pip install changelogged==0.11.3
- name: Get Changelog Contents
id: changelog
run: |
DELIMITER=$(openssl rand -base64 12)
VERSION=${{ needs.determine-if-deploy.outputs.version }}
# Need to capture multiline output in env to preserve newlines
echo "content<<${DELIMITER}" >> $GITHUB_ENV
# Add changelog content to the env for release notes
changelogger notes $VERSION --no-pretty >> $GITHUB_ENV
echo ${DELIMITER} >> $GITHUB_ENV
- name: Create Archive
# Create zip archive for release to composer repository (Packagist)
run: |
wrapper_dir="magento2-klaviyo"
rsync -rc --exclude-from=".distignore" "$GITHUB_WORKSPACE/" $wrapper_dir/ --delete --delete-excluded
zip -r ${{ env.ZIP_FILE_NAME }} ./$wrapper_dir
- name: Create GitHub Tag & Release
# Creates GH tag and release, adds zip archive as artifact to release.
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.determine-if-deploy.outputs.version }}
commit: ${{ github.sha }}
name: Release ${{ needs.determine-if-deploy.outputs.version }}
body: ${{ env.content }}
prerelease: true
artifacts: ${{ env.ZIP_FILE_NAME }}
- name: Send PagerDuty alert on failure
if: ${{ failure() }}
uses: award28/[email protected]
with:
pagerduty-integration-key: '${{ secrets.PAGERDUTY_INTEGRATION_KEY }}'
pagerduty-dedup-key: magento_two_cd
integration-release:
runs-on: ubuntu-latest
needs: [determine-if-deploy, github-tag-and-release]
steps:
- run: echo "Releasing to Magento2"
- name: Send PagerDuty alert on failure
if: ${{ failure() }}
uses: award28/[email protected]
with:
pagerduty-integration-key: '${{ secrets.PAGERDUTY_INTEGRATION_KEY }}'
pagerduty-dedup-key: magento_two_cd