Skip to content

Commit

Permalink
Adding code changes on PR to avoid commit directly into main
Browse files Browse the repository at this point in the history
  • Loading branch information
andonyns committed Nov 13, 2023
1 parent 58db219 commit 503a485
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 33 deletions.
37 changes: 4 additions & 33 deletions .github/workflows/on-merge-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,53 +14,24 @@ env:
GITHUB_TOKEN: ${{ secrets.PAT_ATTACH_TO_RELEASE }}

jobs:
upgrade:
name: Upgrade packages
runs-on: ubuntu-latest
defaults:
run:
working-directory: Meadowlark-js
permissions:
contents: write
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- name: Checkout the Repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

- name: Update versions
run: npx [email protected] version prerelease --exact --no-git-tag-version --yes

- name: Set Version
id: set-version
run: |
version=v$(cat lerna.json | jq -r .version)
echo "version=$version" >> "$GITHUB_OUTPUT"
- uses: planetscale/ghcommit-action@4131649dbf2fdf1eb34421702972a5af7b0a8731 # v0.1.18
with:
commit_message: "${{ steps.set-version.outputs.version }}"
repo: ${{ github.repository }}
branch: ${{ github.head_ref || github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

create-pre-releases:
name: Create Pre-Releases
runs-on: ubuntu-latest
needs: upgrade
defaults:
run:
shell: pwsh
working-directory: Meadowlark-js
steps:
- name: Checkout the Repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
# Need full Git history to get the tag version
fetch-depth: 0w

- name: Create Meadowlark Pre-Release
run: |
$version="${{needs.upgrade.outputs.version}}"
$version=$(git describe --tags)
$body = @{
tag_name = $version
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/on-pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,41 @@ jobs:
- name: Linter
run: npm run test:lint

upgrade:
# Upgrade packages on PR only to avoid a double update when pushed to main
name: Upgrade packages
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
defaults:
run:
working-directory: Meadowlark-js
permissions:
contents: write
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- name: Checkout the Repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Update versions
run: npx [email protected] version prerelease --exact --no-git-tag-version --yes

- name: Set Version
id: set-version
run: |
version=v$(cat lerna.json | jq -r .version)
echo "version=$version" >> "$GITHUB_OUTPUT"
- uses: planetscale/[email protected]
with:
commit_message: "${{steps.set-version.outputs.version}}"
repo: ${{ github.repository }}
branch: ${{ github.head_ref || github.ref_name }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

build:
name: Build
needs: lint
Expand Down

0 comments on commit 503a485

Please sign in to comment.