Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

label artifact version and feature selection in CI #264

Merged
merged 11 commits into from
Dec 5, 2024
37 changes: 19 additions & 18 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,29 @@ on:
- "v*"
workflow_dispatch:
inputs:
draft-release:
default: false
description: "Draft Release"
required: false
type: boolean
build-docker:
default: false
description: "Build Docker"
required: false
type: boolean
default: false
build-binary:
default: true
description: "Build Binary"
required: false
type: boolean
default: true
draft-release:
description: "Draft Release"
features:
default: ''
description: "Binary Compilation Features"
options:
- ''
- 'redact-sensitive'
required: false
type: boolean
default: false
type: choice

jobs:
extract-version:
Expand All @@ -35,21 +43,18 @@ jobs:
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
VERSION="${GITHUB_REF#refs/tags/}"
else
SHA_SHORT="$(echo ${GITHUB_SHA} | cut -c1-7)"
BRANCH_NAME_SAFE="${GITHUB_REF_NAME//\//-}" # replaces "/" in branch name with "-"
VERSION="${BRANCH_NAME_SAFE}-${SHA_SHORT}"
VERSION="$(echo ${GITHUB_SHA} | cut -c1-7)"
fi
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "${VERSION}"

echo "### Version: \`${VERSION}\`" >> $GITHUB_STEP_SUMMARY
echo "| | |" >> $GITHUB_STEP_SUMMARY
echo "| ------------------- | ---------------------- |" >> $GITHUB_STEP_SUMMARY
echo "| \`GITHUB_REF_TYPE\` | \`${GITHUB_REF_TYPE}\` |" >> $GITHUB_STEP_SUMMARY
echo "| \`GITHUB_REF_NAME\` | \`${GITHUB_REF_NAME}\` |" >> $GITHUB_STEP_SUMMARY
echo "| \`GITHUB_REF\` | \`${GITHUB_REF}\` |" >> $GITHUB_STEP_SUMMARY
echo "| \`GITHUB_SHA\` | \`${GITHUB_SHA}\` |" >> $GITHUB_STEP_SUMMARY
echo "| \`VERSION\` | \`${VERSION}\` |" >> $GITHUB_STEP_SUMMARY
echo "| \`FEATURES\` | \`${{ github.event.inputs.features || 'none' }}\` |" >> $GITHUB_STEP_SUMMARY

build-binary:
name: Build binary
Expand All @@ -58,8 +63,6 @@ jobs:
runs-on: ${{ matrix.configs.runner }}
container:
image: ubuntu:22.04
env:
VERSION: ${{ needs.extract-version.outputs.VERSION }}
permissions:
contents: write
packages: write
Expand All @@ -74,8 +77,7 @@ jobs:
# - target: aarch64-apple-darwin
# runner: warp-macos-14-arm64-6x
features:
- ""
- "redact-sensitive"
- ${{ github.event.inputs.features || '' }}

steps:
- name: Install dependencies
Expand All @@ -102,13 +104,13 @@ jobs:
- name: Upload rbuilder artifact
uses: actions/upload-artifact@v4
with:
name: rbuilder-${{ matrix.configs.target }}${{ matrix.features && '-' }}${{ matrix.features }}
name: rbuilder-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}${{ matrix.features && '-' }}${{ matrix.features }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this results in such filenames:

rbuilder-workflows-release-version-6725aee-aarch64-unknown-linux-gnu-redact-sensitive

why is the workflows-release-version useful? this seems to be added by this change πŸ€”

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no strong feelings. I dropped it, updated run here.

path: target/${{ matrix.configs.target }}/release/rbuilder

- name: Upload reth-rbuilder artifact
uses: actions/upload-artifact@v4
with:
name: reth-rbuilder-${{ matrix.configs.target }}${{ matrix.features && '-' }}${{ matrix.features }}
name: reth-rbuilder-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}${{ matrix.features && '-' }}${{ matrix.features }}
path: target/${{ matrix.configs.target }}/release/reth-rbuilder

draft-release:
Expand Down Expand Up @@ -174,7 +176,6 @@ jobs:
- name: docker buildx
uses: docker/setup-buildx-action@v3

# https://github.com/docker/metadata-action
- name: docker metadata
uses: docker/metadata-action@v5
id: meta
Expand Down
Loading