Skip to content

Master Release

Master Release #34

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