release‐workflow‐getting starded - ni/labview-icon-editor GitHub Wiki
This document provides everything you need to understand, configure, and troubleshoot the Build VI Package GitHub Action for the LabVIEW Icon Editor. It covers why we use semantic versioning, how the build number is calculated, what happens on a fork, and step-by-step instructions for various usage scenarios.
The Build VI Package GitHub Action provides a continuous integration (CI) and release pipeline for the LabVIEW Icon Editor project. Key highlights:
- Semantic Versioning: We automatically increment Major, Minor, or Patch based on Pull Request labels.
- Global Build Number: Each release increments a build number by counting how many prior version tags exist.
-
Support for Forks: We temporarily disable GPG signing if you aren’t in the main
ni/labview-icon-editor
repository. -
Pre-Releases on
release/*
branches and final releases on merges tomain
or hotfix branches.
By the end of this guide, you’ll know how to:
- Label a PR or push a commit to produce a Major, Minor, or Patch version.
- Generate pre-release (RC) tags vs. final releases.
- Troubleshoot common issues and adapt the workflow for your own use cases.
Follow these steps to use the Build VI Package Action:
-
Ensure the Workflow File Exists
- In your repo, go to
.github/workflows/build-vi-package.yml
. Confirm it has the final PowerShell-based script.
- In your repo, go to
-
Check Permissions
- Under Repository → Settings → Actions, ensure “Workflow Permissions” are set to “Read and write.” This lets the Action push tags and create releases.
-
Open a Pull Request
- If you open a PR, apply a label:
major
,minor
, orpatch
. - The workflow tests the build and calculates a version but doesn’t push tags or create a release until merge.
- If you open a PR, apply a label:
-
Merge
- If you merge a release/* branch, you get a pre-release (
-rc.<N>
). - If you merge into
main
or fromhotfix/*
, you get a final release version (no-rc
).
- If you merge a release/* branch, you get a pre-release (
-
Check Artifacts
- After a successful build, the
.vip
file is uploaded as a GitHub Artifact. - A GitHub Release is created referencing the new tag.
- After a successful build, the
Below is the deeper dive into how the workflow operates, including the version bump logic, global build numbering, and special handling for forks.
-
Triggers: On push or pull request to
main
,develop
,release/*
, orhotfix/*
. Also on manualworkflow_dispatch
. - Checkout & Tag Analysis: We do a full-depth clone so we see all tags.
-
Label Enforcement (PR-only): Fails if you haven’t labeled your PR with
major
,minor
, orpatch
. -
Version Bumping: If it’s a push without a PR label, we default to
patch
. -
Tag Counting: We list tags matching
v*.*.*-build*
. That total count + 1 → new build number. - Create & Push Tag: If not a PR, we push the new tag and create a GitHub Release.
-
PR with
major
label → increment Major. Reset Minor, Patch = 0. -
PR with
minor
label → increment Minor. Reset Patch = 0. -
PR with
patch
label → increment Patch. - No label or direct push → increment Patch by default.
For example:
- Current version:
v1.2.3-build45
-
major
→v2.0.0-build46
-
minor
→v1.3.0-build46
-
patch
→v1.2.4-build46
-
Count Existing Tags matching
v*.*.*-build*
. - The new build =
(# of matching tags) + 1
. - We append
-build<Number>
to the new version (e.g.v1.2.4-build46
). - If the branch is
release/*
, we also append-rc.<N>
(e.g.v1.2.4-rc.2-build46
). - After computing this version, we do:
resulting in a unique tag each time.
git tag -a $VERSION -m "Auto-tag by CI for $VERSION" git push origin $VERSION
- If
github.repository != 'ni/labview-icon-editor'
, we assume we’re on a fork. - We disable
commit.gpgsign
andtag.gpgsign
globally, because the fork can’t sign using the main repo’s GPG keys. - We record the old config so we can restore it after the workflow finishes.
Below are some common issues and how to fix them:
-
“The term 'VERSION=...' is not recognized”
- That’s a Bash-style variable assignment. Make sure you’re using
$VERSION = "..."
in PowerShell.
- That’s a Bash-style variable assignment. Make sure you’re using
-
403 Permission
- If you see “Resource not accessible by integration,” your token or environment might be restricted. Check “Settings → Actions → Workflow Permissions.”
-
Tag or Release Not Created
- Possibly you used a Pull Request event. The workflow only tags on push, not PR. Or the step might be skipped if the build failed earlier.
-
Incorrect Build Number
- If old tags were deleted or forcibly rewritten, the count might shift. Usually keep tags forever to ensure a stable sequence.
-
How do I do a Major bump if I forget the label?
- You can re-run the PR with the correct label or just push a new commit with the
major
label. Otherwise, it defaults to patch.
- You can re-run the PR with the correct label or just push a new commit with the
-
Why do we use
rc.<N>
onrelease/*
branches?- This indicates a “release candidate.” Each new commit increments
<N>
by counting commits on that branch or fromdevelop
. Merging tomain
finalizes the version.
- This indicates a “release candidate.” Each new commit increments
-
Can I override the build number manually?
- Not in the default script. If you want, you can add a step to read an input or do extra logic, but the default approach is purely tag-count-based.
-
What if I want to skip GPG signing in the main repo?
- You can adjust or remove the GPG logic. Currently, it’s only disabled for forks.
-
If I run
workflow_dispatch
manually, how do I do a major or minor bump?- The default script sets patch if no label is found. If you want a UI prompt or different logic, you can edit the “Determine bump type” step to read an input.
With these guidelines, you have a clear path for using, maintaining, and debugging the Build VI Package workflow for LabVIEW Icon Editor.