Hey all, I couldn't find a better solution but I'd love to hear if anyone has a faster way of releasing multiple versions at once.
Problem: we had ~100 old Archived versions that were showing in our filters because they were also Unreleased.
Solution TL;DR:
- Create an automation:
- Trigger: Scheduled
- Action: Release Version (check the overwrite date box)
- Export the automation
- Open the Json file (I used Xcode)
- Duplicate the Release Action code block
- Replace the Version number in the code block with one of the versions you want to release
- Repeat #4 and #5 for all the versions you want to release
- Make sure the code after the last component is the same as it was originally (it shouldn't have changed just moved down)
- Import the new Json file
- Run the new automation
Note: if the versions you're trying to release are Archived, they'd still show as Archived but have a Release Date and won't show when filtering for Unreleased.
Same solution - but the long version:
The original base automation looked like this:
I added the "QQQ" to make it easier for me to spot where the remove the version
Getting a list of versions to release
If you have ScriptRunner:
- Create a new Scheduled job
- Copy paste the code to get a list of versions from here adding your project code
def versions = get("/rest/api/2/project/${ProjectKey}/versions")
.header('Content-Type', 'application/json')
.asObject(List).body as List
3. Run it to get a list of versions and their status (released, archived, etc)
Adding additional Release Versions actions to the automation we've created at the start
1. Export the automation
2. Open the Json file (I used Xcode but it's possible Notepad will work as well)
3. Locate the block of code that's the Release Action. Should be after the first mentioning of "components" and before "canOtherRuleTrigger"
4. Duplicate the block of text and change the version name each time to a version from your list. There are several ways to make this quicker, like in excel or Google Sheet:
- Identify where in the block of code the version name goes
- Place the first part of the code (before the version name) in column A, the version name in column B, and the last part of the code in column C.
- Copy A and C as is all the way down and column B should be all the version names
- Use COCAT or & to combine them and copy the result from column C.
I used basic beginner C++:
note: the names of my versions where numbers. Otherwise use vector <string>
note#2: use C++ string converter to convert the Json code from the automation to a string with no errors.
#include <iostream>
#include <vector>
using namespace std;
vector <int>number{1, 2, 3} //the list of your versions
string part_1 = "{\"id\":\"476443792\",\"component\":\"ACTION\",\"parentId\":null,\"conditionParentId\":null,\"schemaVersion\":1,\"type\":\"jira.version.release\",\"value\":{\"versionName\":\"";
string part_2 = "\",\"releaseDate\":null,\"overrideReleaseDate\":\"ALWAYS_OVERRIDE\",\"project\":{\"type\":\"ID\",\"value\":\"YOUR PROJECT NUMBER\",\"additional\":\"software\"}},\"children\":[],\"conditions\":[],\"connectionId\":null},"; //note that this code needs YOUR project number
int main()
{for (int i=0;i < number.size();i++)
{ cout<<part_1<<number.at(i)<<part_2<<endl; } } //note: the last block of code created with have a "," at the end that needs to be removed
Update the Json file
- I removed the last "," from the generated blocks of code, and pasted them in original Json file right after the first block ends (\"connectionId\":null}) keeping the rest of the code as is.
- Saved the Json file
- Jira > Automation > Import
- Choose the modified Json file
Run the newly created automation
The new automation should look like the old one but with multiple components to release a version.
Run it!
Note if you're releasing archived versions:
On the Release they will still show as Archived by they have a Release Date and shouldn't show up when filtering for Unreleased.