insomnia/.github/workflows/release-start.yml

94 lines
3.1 KiB
YAML
Raw Normal View History

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: true
description: version of the release (e.g. 2022.1.0)
iteration:
required: false
description: iteration of the release, used for non-stable releases (version-channel.iteration) (e.g. 0, 1, 2, 3 ...)
default: '0'
env:
RELEASE_VERSION: ${{ github.event.inputs.version }}${{ github.event.inputs.channel != 'stable' && format('-{0}.{1}', github.event.inputs.channel, github.event.inputs.iteration) || '' }}
RELEASE_BRANCH: release/${{ github.event.inputs.version }}${{ github.event.inputs.channel != 'stable' && format('-{0}.{1}', github.event.inputs.channel, github.event.inputs.iteration) || '' }}
jobs:
setup-release-branch:
runs-on: ubuntu-latest
steps:
- 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 # Check out the new branch
uses: actions/checkout@v3
with:
ref: ${{ env.RELEASE_BRANCH }}
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- 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' }}
- name: Run bootstrap
run: npm run bootstrap
- name: Config version
run: APP_VERSION="${{ env.RELEASE_VERSION }}" npm run app-bump-version
- name: Lerna version
run: npm run version -- --preid "${{ github.event.inputs.channel }}" --yes ${{ github.event.inputs.channel != 'stable' && 'preminor' || 'minor' }}
- name: Commit
run: git commit -am "Bump app version to ${{ env.RELEASE_VERSION }} and lerna package versions"
- name: Push changes
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 }}
create-pull-request:
needs: setup-release-branch
runs-on: ubuntu-latest
steps:
- name: Checkout branch # Check out the new branch
uses: actions/checkout@v3
with:
ref: ${{ env.RELEASE_BRANCH }}
fetch-depth: 0
- 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