Skip to content

Commit

Permalink
chore: nightlies in sh
Browse files Browse the repository at this point in the history
Signed-off-by: Case Wylie <[email protected]>
  • Loading branch information
cmwylie19 committed Jan 29, 2025
1 parent c84efec commit bd3fd9a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 33 deletions.
34 changes: 1 addition & 33 deletions .github/workflows/nightlies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,36 +44,4 @@ jobs:
- name: Publish to GHCR and NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
#!/bin/bash
npm install -g npm
LATEST_VERSION=$(npx pepr@latest version 2>/dev/null)
RAW_NIGHTLY_VERSION=$(npx pepr@nightly version 2>/dev/null || echo "none")
if [[ "$RAW_NIGHTLY_VERSION" == "none" ]]; then
echo "No nightly version found. Setting NIGHTLY_VERSION=0."
NIGHTLY_VERSION=0
else
NIGHTLY_VERSION_PART=$(echo "$RAW_NIGHTLY_VERSION" | grep -oE "nightly\.([0-9]+)" | cut -d. -f2)
BASE_NIGHTLY_VERSION=${RAW_NIGHTLY_VERSION%-nightly*}
if [[ "$LATEST_VERSION" > "$BASE_NIGHTLY_VERSION" ]]; then
echo "Nightly version is less than the latest version. Resetting NIGHTLY_VERSION to 0."
NIGHTLY_VERSION=0
else
NIGHTLY_VERSION=$((NIGHTLY_VERSION_PART + 1))
echo "Incrementing NIGHTLY_VERSION to $NIGHTLY_VERSION."
fi
fi
FULL_VERSION="${LATEST_VERSION}-nightly.${NIGHTLY_VERSION}"
echo "FULL_VERSION=$FULL_VERSION" >> $GITHUB_ENV
npm version --no-git-tag-version $FULL_VERSION
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/defenseunicorns/pepr/controller:$FULL_VERSION .
npm publish --tag "nightly"
run: ./scripts/nightlies.sh
38 changes: 38 additions & 0 deletions scripts/nightlies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2023-Present The Pepr Authors

# Script to build and publish nightly versions of Pepr Controller and Pepr CLI.

set -e
npm install -g npm

LATEST_VERSION=$(npx --yes pepr@latest --version 2>/dev/null)
RAW_NIGHTLY_VERSION=$(npx --yes pepr@nightly --version 2>/dev/null || echo "none")

if [[ "$RAW_NIGHTLY_VERSION" == "none" ]]; then
echo "No nightly version found. Setting NIGHTLY_VERSION=0."
NIGHTLY_VERSION=0
else
NIGHTLY_VERSION_PART=$(echo "$RAW_NIGHTLY_VERSION" | grep -oE "nightly\.([0-9]+)" | cut -d. -f2)

BASE_NIGHTLY_VERSION=${RAW_NIGHTLY_VERSION%-nightly*}
if [[ "$LATEST_VERSION" > "$BASE_NIGHTLY_VERSION" ]]; then
echo "Nightly version is less than the latest version. Resetting NIGHTLY_VERSION to 0."
NIGHTLY_VERSION=0
else
NIGHTLY_VERSION=$((NIGHTLY_VERSION_PART + 1))
echo "Incrementing NIGHTLY_VERSION to $NIGHTLY_VERSION."
fi
fi

FULL_VERSION="${LATEST_VERSION}-nightly.${NIGHTLY_VERSION}"

echo "FULL_VERSION=$FULL_VERSION" >> "$GITHUB_ENV"

npm version --no-git-tag-version "$FULL_VERSION"

docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/defenseunicorns/pepr/controller:"$FULL_VERSION" .

npm publish --tag "nightly"

0 comments on commit bd3fd9a

Please sign in to comment.