Fixes pruning saved emails when there's a duplicate entry. #328
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Create and publish releases" | |
on: | |
pull_request: | |
branches: | |
- main | |
types: [closed] | |
jobs: | |
release: | |
name: "Create Release" | |
runs-on: ubuntu-latest | |
if: >- | |
${{ github.event.pull_request.merged == true && ( | |
contains(github.event.pull_request.labels.*.name, 'patch') || | |
contains(github.event.pull_request.labels.*.name, 'minor') || | |
contains(github.event.pull_request.labels.*.name, 'major') ) }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{secrets.GITHUB_TOKEN}} | |
persist-credentials: true | |
- name: Setup git user | |
run: | | |
git config user.name "Amal dinesh" | |
git config user.email "amalkdinesh@gmail.com" | |
- name: Setup NodeJS LTS version | |
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Setup the project | |
run: yarn install | |
- name: Generate production build | |
run: yarn bundle | |
- name: Prefix version tag with "v" | |
run: yarn config set version-tag-prefix "v" | |
- name: Disable Git commit hooks | |
run: git config core.hooksPath /dev/null | |
- name: Bump the patch version and create git tag on release | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'patch') }} | |
run: yarn version --patch --no-git-tag-version | |
- name: Bump the minor version and create git tag on release | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'minor') }} | |
run: yarn version --minor --no-git-tag-version | |
- name: Bump the major version and create git tag on release | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'major') }} | |
run: yarn version --major --no-git-tag-version | |
- name: Get the package version from package.json | |
uses: tyankatsu0105/read-package-version-actions@5aad2bb630a577ee4255546eb3ee0593df68f6ca | |
id: package-version | |
- name: Read pull request body | |
uses: 8BitJonny/gh-get-current-pr@2.0.0 | |
id: PR | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
sha: ${{ github.event.pull_request.head.sha }} | |
- name: Extract changelog | |
id: CHANGELOG | |
run: | | |
content=$(echo '${{ steps.PR.outputs.pr_body }}' | python3 -c 'import json; import sys; print(json.dumps(sys.stdin.read().partition("**Description**")[2].partition("**Checklist**")[0].strip()))') | |
echo "CHANGELOG=${content}" >> $GITHUB_ENV | |
shell: bash | |
- name: Update Changelog | |
continue-on-error: true | |
uses: stefanzweifel/changelog-updater-action@v1 | |
with: | |
latest-version: ${{ steps.package-version.outputs.version }} | |
release-notes: ${{ fromJson(env.CHANGELOG) }} | |
- name: Commit and Push changes | |
uses: EndBug/add-and-commit@v7 | |
with: | |
branch: main | |
message: "New version release" | |
- name: Create a release draft on release | |
uses: release-drafter/release-drafter@ac463ffd9cc4c6ad5682af93dc3e3591c4657ee3 | |
if: ${{contains(github.event.pull_request.labels.*.name, 'release')}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag: v${{ steps.package-version.outputs.version }} | |
publish: true | |
- name: Publish the package on NPM | |
uses: JS-DevTools/npm-publish@22595ff8c4d0d9f53cef0656fbb90fbe06ee885c | |
with: | |
access: "public" | |
token: ${{ secrets.NPM_TOKEN }} |