Skip to content

Commit

Permalink
Merge branch 'main' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
thyal committed Feb 13, 2024
2 parents 6c7b7be + 6f09407 commit ba7c7aa
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions .github/workflows/exit-prerelease.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,66 @@
name: Exit Prerelease Mode

on:
workflow_dispatch:
inputs:
branch:
description: "Exit prerelease mode on development branch"
type: string
default: "development"
required: true
pull_request:
branches:
- main

jobs:
exit_prerelease:
name: Changesets Exit Prerelease
runs-on: ubuntu-latest
steps:
# Check if pre.json file exists. The rest of the steps will only run if this file exists
- name: Check for pre.json file existence
id: check_files
uses: andstor/file-existence-action@v3.0.0
with:
files: ".changeset/pre.json"

- name: Checkout repo
uses: actions/checkout@v4
if: steps.check_files.outputs.files_exists == 'true'
with:
# Checkout development branch
ref: ${{ github.event.inputs.branch }}
# Checkout the branch that triggered this workflow (This should be development branch in most cases)
ref: ${{ github.event.pull_request.head.ref }}
# Fetch entire git history so Changesets can generate changelogs
# with the correct commits
fetch-depth: 0

- name: Setup Node.js 20.x
uses: actions/setup-node@v4
if: steps.check_files.outputs.files_exists == 'true'
with:
node-version: 20.x

# Get the previous tag
- name: Get latest tagged version
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1
if: steps.check_files.outputs.files_exists == 'true'

- name: Remove 'v' prefix from version number (e.g. v1.0.0)
uses: mad9000/actions-find-and-replace-string@4
id: formatversion
if: steps.check_files.outputs.files_exists == 'true'
with:
source: ${{ steps.previoustag.outputs.tag }}
find: "v"
replace: ""

- name: Write previous version to package.json
uses: jaywcjlove/github-action-package@v1.3.2
if: steps.check_files.outputs.files_exists == 'true'
with:
version: ${{ steps.formatversion.outputs.value }}

- name: Remove pre.json
if: steps.check_files.outputs.files_exists == 'true'
run: npx rimraf .changeset/pre.json

- uses: stefanzweifel/git-auto-commit-action@v5
if: steps.check_files.outputs.files_exists == 'true'
with:
commit_message: Exit prerelease mode
# Commit these changes to the branch workflow is running against
branch: ${{ github.event.inputs.branch }}
branch: ${{ github.event.pull_request.head.ref }}

0 comments on commit ba7c7aa

Please sign in to comment.