2022-03-09 15:06:53 +00:00
|
|
|
name: Release Start
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
channel:
|
|
|
|
required: true
|
|
|
|
type: choice
|
|
|
|
description: Channel of the release (alpha/beta/stable)
|
|
|
|
options:
|
|
|
|
- alpha
|
|
|
|
- beta
|
|
|
|
- stable
|
|
|
|
version:
|
|
|
|
required: false
|
2024-03-12 15:53:41 +00:00
|
|
|
description: force version of the release (e.g. 9.0.0) leave blank to increment automatically
|
2022-03-09 15:06:53 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
setup-release-branch:
|
2024-02-05 16:21:39 +00:00
|
|
|
timeout-minutes: 5
|
2022-03-09 15:06:53 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-08-10 09:04:28 +00:00
|
|
|
- name: Checkout branch
|
2024-02-26 14:46:25 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-03-09 15:06:53 +00:00
|
|
|
with:
|
2023-08-10 09:34:50 +00:00
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
2023-08-10 09:04:28 +00:00
|
|
|
ref: develop
|
|
|
|
fetch-depth: 0
|
2022-03-09 15:06:53 +00:00
|
|
|
|
2023-08-09 22:14:16 +00:00
|
|
|
- name: Setup Node
|
2024-02-26 14:46:25 +00:00
|
|
|
uses: actions/setup-node@v4
|
2023-08-09 22:14:16 +00:00
|
|
|
with:
|
|
|
|
node-version-file: ".nvmrc"
|
|
|
|
cache: 'npm'
|
|
|
|
cache-dependency-path: package-lock.json
|
2022-03-09 15:06:53 +00:00
|
|
|
|
2023-08-09 22:14:16 +00:00
|
|
|
- name: Install packages
|
|
|
|
run: npm ci
|
|
|
|
|
2023-08-10 09:04:28 +00:00
|
|
|
- name: App version (stable, no version doing patch)
|
|
|
|
if: github.event.inputs.channel == 'stable' && !github.event.inputs.version
|
|
|
|
run: npm --workspaces version patch
|
|
|
|
|
2023-08-09 22:14:16 +00:00
|
|
|
- name: App version (stable)
|
2023-08-10 09:04:28 +00:00
|
|
|
if: github.event.inputs.channel == 'stable' && github.event.inputs.version
|
|
|
|
run: npm --workspaces version "${{ github.event.inputs.version }}"
|
2022-05-02 10:06:52 +00:00
|
|
|
|
2023-09-24 23:53:25 +00:00
|
|
|
# required for 8.0.0 beta
|
|
|
|
- name: App version (initial alpha/beta where we specify a new general version)
|
|
|
|
if: github.event.inputs.channel != 'stable' && github.event.inputs.version
|
|
|
|
run: npm --workspaces version "${{ github.event.inputs.version }}-${{ github.event.inputs.channel }}.0"
|
|
|
|
|
2023-08-09 22:14:16 +00:00
|
|
|
- name: App version (alpha/beta)
|
2023-09-24 23:53:25 +00:00
|
|
|
if: github.event.inputs.channel != 'stable' && !github.event.inputs.version
|
2023-08-10 09:04:28 +00:00
|
|
|
run: npm --workspaces version --preid "${{ github.event.inputs.channel }}" prerelease
|
2022-03-09 15:06:53 +00:00
|
|
|
|
2023-08-10 09:04:28 +00:00
|
|
|
- name: Get version
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "RELEASE_VERSION=$(node -e "console.log(require('./packages/insomnia/package.json').version)")" >> $GITHUB_ENV
|
|
|
|
echo "RELEASE_BRANCH=release/$(node -e "console.log(require('./packages/insomnia/package.json').version)")" >> $GITHUB_ENV
|
2022-04-20 14:56:25 +00:00
|
|
|
|
2023-08-10 09:46:19 +00:00
|
|
|
# - name: Git create branch locally # Check out the new branch
|
|
|
|
# run: git checkout -b ${{ env.RELEASE_BRANCH }}
|
|
|
|
|
|
|
|
- name: Create Branch # Create a branch if it doesn't exist
|
|
|
|
uses: peterjgrainger/action-create-branch@v2.0.1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
branch: ${{ env.RELEASE_BRANCH }}
|
|
|
|
|
|
|
|
- name: Checkout branch
|
2024-02-26 14:46:25 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-08-10 09:46:19 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ env.RELEASE_BRANCH }}
|
|
|
|
persist-credentials: false
|
|
|
|
|
2023-08-10 09:04:28 +00:00
|
|
|
- name: Configure Git user
|
|
|
|
id: configure_git_user
|
|
|
|
uses: Homebrew/actions/git-user-config@master
|
|
|
|
with:
|
|
|
|
username: ${{ (github.event_name == 'workflow_dispatch' && github.actor) || 'insomnia-infra' }}
|
|
|
|
|
2023-08-10 09:51:45 +00:00
|
|
|
- name: (Re-run) App version (stable, no version doing patch)
|
|
|
|
if: github.event.inputs.channel == 'stable' && !github.event.inputs.version
|
|
|
|
run: npm --workspaces version patch
|
|
|
|
|
|
|
|
- name: (Re-run) App version (stable)
|
|
|
|
if: github.event.inputs.channel == 'stable' && github.event.inputs.version
|
|
|
|
run: npm --workspaces version "${{ github.event.inputs.version }}"
|
|
|
|
|
2023-09-26 12:20:22 +00:00
|
|
|
# required for 8.0.0 beta
|
|
|
|
- name: (Re-run) App version (initial alpha/beta where we specify a new general version)
|
|
|
|
if: github.event.inputs.channel != 'stable' && github.event.inputs.version
|
|
|
|
run: npm --workspaces version "${{ github.event.inputs.version }}-${{ github.event.inputs.channel }}.0"
|
|
|
|
|
2023-08-10 09:51:45 +00:00
|
|
|
- name: (Re-run) App version (alpha/beta)
|
2023-09-26 12:20:22 +00:00
|
|
|
if: github.event.inputs.channel != 'stable' && !github.event.inputs.version
|
2023-08-10 09:51:45 +00:00
|
|
|
run: npm --workspaces version --preid "${{ github.event.inputs.channel }}" prerelease
|
|
|
|
|
2023-08-10 09:04:28 +00:00
|
|
|
- name: Git Commit
|
2023-08-09 22:14:16 +00:00
|
|
|
run: git commit -am "Bump app version to ${{ env.RELEASE_VERSION }}"
|
2022-03-09 15:06:53 +00:00
|
|
|
|
2023-08-10 09:04:28 +00:00
|
|
|
- name: Git Push changes
|
2022-03-09 15:06:53 +00:00
|
|
|
run: |
|
|
|
|
remote_repo="https://${GITHUB_ACTOR}:${RELEASE_GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
|
|
|
|
git push "${remote_repo}" --follow-tags
|
|
|
|
env:
|
|
|
|
RELEASE_GH_TOKEN: ${{ secrets.RELEASE_GH_TOKEN }}
|
|
|
|
|
|
|
|
- name: Run the Action
|
|
|
|
uses: devops-infra/action-pull-request@v0.4.2
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.RELEASE_GH_TOKEN }}
|
|
|
|
source_branch: ${{ env.RELEASE_BRANCH}}
|
|
|
|
target_branch: develop
|
|
|
|
title: ":rocket: ${{ env.RELEASE_VERSION}}"
|
|
|
|
body: |
|
|
|
|
**Automated pull request**
|
|
|
|
Artifacts build in progress...
|
|
|
|
draft: false
|