release.yml #39
Workflow file for this run
This file contains hidden or 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
| 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 }} | |
| update-install-scripts: | |
| if: ${{ !inputs.jar-only }} | |
| 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 | |
| # https://github.com/actions/runner/issues/491#issuecomment-850884422 | |
| if: always() && (needs.update-install-scripts.result == 'success' || needs.update-install-scripts.result == 'skipped') | |
| 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 }} |