Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release.yml #727

Merged
merged 2 commits into from
Jul 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.OR_GITHUB_TOKEN }}
BRANCH_NAME: npm-version-patch
steps:

# CHECKOUT PROJECT
Expand All @@ -76,7 +77,7 @@ jobs:
if [ ${{ inputs.dev }} == true ]; then
echo "TAG_NAME=$(npm version prerelease --preid=${{ inputs.jsTag }} --no-git-tag-version --allow-same-version)" >> $GITHUB_ENV
else
echo "TAG_NAME=$(npm version patch)" >> $GITHUB_ENV
echo "TAG_NAME=$(npm version patch --no-git-tag-version)" >> $GITHUB_ENV
fi

# DOWNLOAD CLI IF IT IS A DEV VERSION AND A CLI TAG WAS PROVIDED
Expand All @@ -93,11 +94,42 @@ jobs:
npm ci
npm run build

# CREATE PR FOR VERSION
- name: Create Pull Request
id: create_pr
if: inputs.dev == false
uses: peter-evans/[email protected]
with:
token: ${{ env.GITHUB_TOKEN }}
branch: ${{ env.BRANCH_NAME }}
title: "Update Version - Automated Changes"
body: "This is an automated PR created by GitHub Actions"
base: main
draft: false

# WAIT FOR PR CREATION
- name: Wait for PR to be created
id: pr
if: inputs.dev == false
uses: octokit/[email protected]
with:
route: GET /repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${{ env.BRANCH_NAME }}

# MERGE PR TO MAIN
- name: Merge Pull Request
if: inputs.dev == false
uses: octokit/[email protected]
with:
route: PUT /repos/${{ github.repository }}/pulls/${{ steps.create_pr.outputs.pull-request-number }}/merge
merge_method: squash

# PUSH TAGS IF IT IS A RELEASE
- name: Push tag if release
- name: Push tag
if: inputs.dev == false
run: git push && git push --tags
run: |
git pull
git tag ${{env.TAG_NAME}}
git push --tags


# PUBLISH NPM PACKAGE
Expand Down