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 themaster
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 allow the workflow to be rerun after changes have been pushed, add this input to
- To trigger Octorelease on demand, you can use the
workflow_dispatch
event to trigger releases manually with a button click, or therepository_dispatch
event to trigger releases using a REST API call.
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.