Skip to content

Commit

Permalink
add fix for nightly workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Soule BA <bah.soule@gmail.com>
  • Loading branch information
souleb committed Oct 19, 2023
1 parent 18d85fe commit 2fa8fb9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/nightly_v21.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ssh-key: "${{ secrets.NIGHTLY_BUILD_KEY }}"
fetch-depth: 0
- name: Push nightly tag
shell: bash
run: |
git config --global user.name "Soule BA"
git config --global user.email "soule@weave.works"
# Get the latest release tag
git fetch 'refs/tags/*:refs/tags/*'
DESCRIBE=$(git tag -l --sort=-v:refname | grep -v nightly | head -n 1)
MAJOR_VERSION=$(echo $DESCRIBE | awk '{split($0,a,"."); print a[1]}')
MINOR_VERSION=$(echo $DESCRIBE | awk '{split($0,a,"."); print a[2]}')
PATCH_VERSION=$(echo $DESCRIBE | awk '{split($0,a,"."); print a[3]}')
PATCH_NUMBER=$(echo $DESCRIBE | awk '{split($0,a,"."); print a[4]}')
TAG="${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}
TAG="${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}"
if [[ "$PATCH_NUMBER" =~ ^[0-9]+$ ]]; then
TAG="${TAG}.${PATCH_NUMBER}"
fi
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/release_v21.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
id: version
shell: bash
run: |
if [[ "{{ github.ref_name }}" == "*.nightly*" ]]; then
if [[ "${{ github.ref }}" == refs/tags/v*.nightly* ]]; then
echo "nightly=true" >> $GITHUB_OUTPUT
else
echo "nightly=false" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -212,7 +212,7 @@ jobs:
contents: write # needed to write releases
id-token: write # needed for keyless signing
packages: write # needed for ghcr access
needs: [sc-ghcr-provenance, kc-ghcr-provenance, hc-ghcr-provenance, irc-ghcr-provenance, iac-ghcr-provenance, nc-ghcr-provenance]
needs: [nightly-tag,sc-ghcr-provenance, kc-ghcr-provenance, hc-ghcr-provenance, irc-ghcr-provenance, iac-ghcr-provenance, nc-ghcr-provenance]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -250,13 +250,17 @@ jobs:
ln -s patches-flux-v21 patches-flux
rm -rf flux2 || true
source ./patches-flux/VERSION
# set LATEST_RELEASE to true by default
# it will be set to false if the release is a nightly build
LATEST_RELEASE=true
if [[ "$FLUX2_SUFFIX_VERSION" =~ ^wa[.][0-9]+$ ]]; then
VERSION=${FLUX2_BASE_VERSION}-${FLUX2_SUFFIX_VERSION}
else
VERSION=${FLUX2_BASE_VERSION}-wa
fi
if [[ "${{ needs.nightly-tag.outputs.nightly }}" == "true" ]]; then
VERSION=${VERSION}-nightly.$(date +%y%m%d%H%M%S)
LATEST_RELEASE=false
else
VERSION=${VERSION}.$(date +%y%m%d%H%M%S)
fi
Expand All @@ -265,6 +269,7 @@ jobs:
RAW_VERSION=$(echo $VERSION | cut -c2-)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "raw_version=${RAW_VERSION}" >> $GITHUB_OUTPUT
echo "latest_release=${LATEST_RELEASE}" >> $GITHUB_OUTPUT
- name: Download all controllers release artifacts
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -324,6 +329,7 @@ jobs:
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
BUILD_VERSION: ${{ steps.patch.outputs.version }}
BUILD_VERSION_RAW: ${{ steps.patch.outputs.raw_version }}
LATEST_RELEASE: ${{ steps.patch.outputs.latest_release }}
- name: Generate SLSA metadata
id: slsa
env:
Expand All @@ -342,7 +348,7 @@ jobs:
release-flux-manifests:
runs-on: ubuntu-latest
needs: release-flux-cli
needs: [nightly-tag, release-flux-cli]
permissions:
id-token: write
packages: write
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ sboms:
documents:
- "{{ .ProjectName }}_{{ .Version }}_sbom.spdx.json"
release:
make_latest: "{{ .Env.LATEST_RELEASE }}"
extra_files:
- glob: output/crd-schemas.tar.gz
- glob: output/manifests.tar.gz
Expand Down

0 comments on commit 2fa8fb9

Please sign in to comment.