Skip to content

[RND-649] Add lerna version update process into GitHub Action (#316) #81

[RND-649] Add lerna version update process into GitHub Action (#316)

[RND-649] Add lerna version update process into GitHub Action (#316) #81

# SPDX-License-Identifier: Apache-2.0
# Licensed to the Ed-Fi Alliance under one or more agreements.
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
# See the LICENSE and NOTICES files in the project root for more information.
name: On Merge to Main
on:
push:
branches:
- main
env:
API_URL: https://api.github.com/repos/${{ github.repository }}
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
- name: Create Meadowlark Pre-Release
run: |
$version="${{needs.upgrade.outputs.version}}"
$body = @{
tag_name = $version
target_commitish = "main"
name = $version
body = ""
draft = $false
prerelease = $true
generate_release_notes = $false
} | ConvertTo-Json
$headers = @{
Accept = "application/vnd.github+json"
Authorization = "Bearer ${{ env.GITHUB_TOKEN }}"
}
Invoke-RestMethod -Method POST -Uri ${{ env.API_URL }}/releases -Body $body -Headers $headers