-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AXON-19] feat: nightly versioning & release scripts
- Loading branch information
1 parent
23bc418
commit ca39211
Showing
7 changed files
with
172 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,31 +3,39 @@ name: Release Nightly | |
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
workflow_call: {} | ||
# Can be triggered manually if needed | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
release: | ||
release-nightly: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# TODO if we want to publish this, just a different version is not enough | ||
# We'd probably want to use a different id for the extension, too - e.g. atlascode-nightly | ||
- name: Evaluate version | ||
run: | | ||
RELEASE_VERSION=$(./nightlyver.sh ${GITHUB_SHA}) && \ | ||
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV && \ | ||
echo "Using version '${RELEASE_VERSION}'" | ||
- name: Set version | ||
run: npm -no-git-tag-version --allow-same-version -f version $RELEASE_VERSION | ||
PACKAGE_VERSION=$(./scripts/version/get-next-nightly.sh) | ||
./scripts/version/assert-nightly.sh $PACKAGE_VERSION | ||
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV | ||
echo "RELEASE_TAG=v${PACKAGE_VERSION}" >> $GITHUB_ENV | ||
echo "Using version '${PACKAGE_VERSION}'" | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
|
||
- name: Set version | ||
run: | | ||
npm -no-git-tag-version --allow-same-version -f version $PACKAGE_VERSION | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
|
@@ -40,4 +48,33 @@ jobs: | |
- name: Build the extension | ||
run: npm run extension:package | ||
|
||
# No publish actions here for the time being - let's get the builds going first | ||
# No VSCE/OVSX publish actions here for the time being - let's get the builds going first | ||
|
||
- name: Create Tag | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Nightly Release Bot" | ||
git tag -a $RELEASE_TAG -m "Nightly build for $(date +'%Y-%m-%d %H:%M')" | ||
git push origin $RELEASE_TAG | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.RELEASE_TAG }} | ||
release_name: Release ${{ env.RELEASE_TAG }} | ||
draft: false | ||
prerelease: true | ||
|
||
- name: Upload Release Assets | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./atlascode-${{ env.PACKAGE_VERSION }}.vsix | ||
asset_name: atlascode-${{ env.PACKAGE_VERSION }}.vsix | ||
asset_content_type: application/zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Make sure that the minor version is odd | ||
version=$1 | ||
|
||
if [[ $version =~ ^[0-9]+\.[0-9]*[13579]\.[0-9]+.*$ ]]; then | ||
echo "Version $version is a valid pre-release (odd minor version)" | ||
exit 0 | ||
else | ||
echo "Version $version is not a valid pre-release (even minor version or invalid format)" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Make sure that the minor version is even | ||
version=$1 | ||
|
||
if [[ $version =~ ^[0-9]+\.[0-9]*[02468]\.[0-9]+$ ]]; then | ||
echo "Version $version is a valid stable release (even minor version)" | ||
exit 0 | ||
else | ||
echo "Version $version is not a valid stable release (odd minor version or invalid format)" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
n_release=${1:-1} | ||
|
||
# Get latest nightly tag from the repository | ||
# Pre-releases are defined by the version number having an ODD minor number | ||
# https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions | ||
git tag --list | \ | ||
sort --version-sort -r | \ | ||
grep -E '^v[0-9]+\.[0-9]*[13579]\.[0-9]+.*' | \ | ||
head -n $n_release | \ | ||
tail -n 1 | \ | ||
cut -c 2- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
n_release=${1:-1} | ||
|
||
# Get latest release tag from the repository | ||
# Stable releases are defined by the version number having an EVEN minor number | ||
# https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions | ||
git tag --list | \ | ||
sort --version-sort -r | \ | ||
grep -E '^v[0-9]+\.[0-9]*[02468]\.[0-9]+$' | \ | ||
head -n $n_release | \ | ||
tail -n 1 | \ | ||
cut -c 2- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Nightly version is defined by the latest stable release tag, | ||
# except the minor version is incremented by one | ||
# https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions | ||
|
||
git fetch --tags -q | ||
latest_stable_version=$(./scripts/version/get-latest-stable.sh) | ||
latest_nightly_version=$(./scripts/version/get-latest-nightly.sh) | ||
|
||
# Major version is the same as the latest stable version | ||
stable_major=$(echo $latest_stable_version | cut -d '.' -f 1) | ||
nightly_major=$(echo $latest_nightly_version | cut -d '.' -f 1) | ||
|
||
# Minor version is always "latest stable + 1" | ||
stable_minor=$(echo $latest_stable_version | cut -d '.' -f 2) | ||
nightly_minor=$(echo $latest_nightly_version | cut -d '.' -f 2) | ||
next_minor=$((stable_minor + 1)) | ||
|
||
# Patch is incrementing, unless we're on a new minor | ||
if [[ $nightly_major -eq $stable_major && $next_minor -eq $nightly_minor ]]; then | ||
nightly_patch=$(echo $latest_nightly_version | cut -d '.' -f 3 | cut -d '-' -f 1) | ||
nightly_patch=${nightly_patch:--1} # In case of new nightly minor | ||
next_patch=$((nightly_patch + 1)) | ||
else | ||
next_patch=0 | ||
fi | ||
|
||
echo "$stable_major.$next_minor.$next_patch-nightly" |