Skip to content

Latest commit

 

History

History
81 lines (63 loc) · 2.36 KB

recipes.md

File metadata and controls

81 lines (63 loc) · 2.36 KB

Recipes

CI Configurations

GitHub Actions

The following is a minimal configuration for Octorelease with a build running on the latest LTS version of Node when a new commit is pushed to a master branch.

name: Release

on:
  push:
    branches:
      - master

jobs:
  release:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v4
      with:
        fetch-depth: 0

    - name: Setup Node
      uses: actions/setup-node@v4
      with:
        node-version: 'lts/*'

    - name: Install Dependencies
      run: npm ci

    - name: Publish Release
      uses: zowe-actions/octorelease@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Notes:

  • To keep package.json updated in the master branch, @octorelease/git plugin can be used.
    • To allow the workflow to be rerun after changes have been pushed, add this input to @actions/checkout:
      ref: ${{ github.ref }}
    • Automatically populated GITHUB_TOKEN variable cannot be used if branch protection is enabled for the target branch. In this case you need to create a personal access token with elevated permissions and should be aware of the security risks of using it.
  • To trigger Octorelease on demand, you can use the workflow_dispatch event to trigger releases manually with a button click, or the repository_dispatch event to trigger releases using a REST API call.

Jenkins

The following is a minimal configuration for Octorelease with a declarative pipeline running Node.

pipeline {
    agent any  // Use agent with Node.js preinstalled

    environment {
        GITHUB_TOKEN = credentials('GITHUB_TOKEN')
        NPM_TOKEN = credentials('NPM_TOKEN')
    }

    stages {
        stage("Install Dependencies") {
            steps {
                sh "npm ci"
            }
        }

        stage("Publish Release") {
            steps {
                sh "npx octorelease"
            }
        }
    }
}

Notes:

  • For Octorelease to read Git history, make sure "shallow clone" is disabled in the Git settings for your pipeline.