Skip to content

release.yml

release.yml #33

Workflow file for this run

name: release.yml
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., v1.0.0)'
required: true
type: string
prerelease:
description: 'Is this a prerelease?'
required: false
type: boolean
default: false
jar-only:
description: 'Release only the fat jar'
required: false
type: boolean
default: false
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify versions are up to date
run: |
files=(
"build.gradle.kts"
"src/test/resources/snapshots/AstraCli/help_output.human.approved.txt"
)
tag="${{ inputs.tag }}"
missing_files=()
for f in "${files[@]}"; do
if ! grep -q "${tag#v}" "$f"; then
missing_files+=("$f")
fi
done
if [ ${#missing_files[@]} -ne 0 ]; then
echo "ERROR: Version not found in the following files:"
printf '%s\n' "${missing_files[@]}"
exit 1
fi
build:
needs: verify
uses: ./.github/workflows/build.yml
with:
upload-artifacts: true
build-native: ${{ inputs.jar-only == 'false' }}
update-install-scripts:
needs: build
uses: ./.github/workflows/update-install-scripts.yml
permissions:
contents: write
pull-requests: write
with:
tag: ${{ inputs.tag }}
release:
needs: [ build, update-install-scripts ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Determine artifact list
id: artifact-list
run: |
if [ "${{ inputs.jar-only }}" = "true" ]; then
echo "files=artifacts/astra-cli-fat-jar/*" >> $GITHUB_OUTPUT
else
{
echo "files<<EOT"
echo "artifacts/astra-cli-linux-x86_64/*"
echo "artifacts/astra-cli-windows-x86_64/*"
echo "artifacts/astra-cli-linux-arm64/*"
echo "artifacts/astra-cli-macos-x86_64/*"
echo "artifacts/astra-cli-macos-arm64/*"
echo "artifacts/astra-cli-fat-jar/*"
echo "EOT"
} >> $GITHUB_OUTPUT
fi
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag }}
name: ${{ inputs.tag }}
prerelease: ${{ inputs.prerelease }}
files: ${{ steps.artifact-list.outputs.files }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}