π± Push build - Cleanup disk space before uploading #21
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: Build Dependencies | |
| run-name: | | |
| ${{ github.event_name == 'push' && 'π± Push build -' || '' }} | |
| ${{ github.event_name == 'pull_request' && format('π¦ Artifacts build for PR {0} - {1}', github.event.pull_request.number, github.event.pull_request.title) || github.event.head_commit.message }} | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| tags: | |
| - '20[2-9][0-9]-[0-9][0-9]-[0-9][0-9]' | |
| pull_request: | |
| branches: | |
| - 'master' | |
| jobs: | |
| # GitHub Push/Pull Request | |
| github_build: | |
| name: ${{ matrix.build.description }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build: [ | |
| { type: 'debug', description: 'Debug build' }, | |
| { type: 'release', description: 'Release build' } | |
| ] | |
| uses: ./.github/workflows/qt5_6.yml | |
| secrets: inherit | |
| with: | |
| build_type: ${{ matrix.build.type }} | |
| upload_artifact: ${{ startsWith(github.event.ref, 'refs/tags') }} | |
| # Publish to GitHub (Only on tagged commits with date format e.g. 2025-01-31) | |
| github_publish: | |
| name: Publish to GitHub | |
| if: ${{ startsWith(github.event.ref, 'refs/tags') }} | |
| needs: github_build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π§Ή Free Disk Space | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| tool-cache: true | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: true | |
| swap-storage: false | |
| - name: β¬ Checkout | |
| uses: actions/checkout@v4 | |
| - name: πΎ Download Artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| path: ${{ github.workspace }}/artifacts | |
| - name: π¦ Repack Artifacts | |
| shell: bash | |
| run: | | |
| json=$(jq -n --arg version "$GITHUB_REF_NAME" --arg baseURL "${{ github.server_url }}/${{ github.repository }}/releases/download" '{version: $version, baseUrl: $baseURL, hashes: {}}') | |
| for artifact in ${{ github.workspace }}/artifacts/*/; do | |
| echo π¦ Repack $(basename "${artifact%/}-${GITHUB_REF_NAME}.tar.gz")... | |
| tar -czf "${artifact%/}-${GITHUB_REF_NAME}.tar.gz" -C "$artifact" . | |
| rm -fR "$artifact" | |
| fname=$(basename ${artifact%/}) | |
| IFS='-' read -ra fname <<< "$fname" | |
| distribution="${fname[0]}" | |
| architecture="${fname[1]}" | |
| qtVersion="${fname[2]#qt}" | |
| buildType="${fname[3]}" | |
| hash=$(sha256sum "${artifact%/}-${GITHUB_REF_NAME}.tar.gz" | cut -d " " -f 1) | |
| json=$(jq \ | |
| --arg distribution "$distribution" \ | |
| --arg architecture "$architecture" \ | |
| --arg qtVersion "$qtVersion" \ | |
| --arg buildType "$buildType" \ | |
| --arg hash "$hash" \ | |
| ' | |
| (.hashes[$distribution][$architecture].qt_version = $qtVersion) | |
| | (.hashes[$distribution][$architecture][$buildType] = $hash) | |
| ' <<< "$json") | |
| done | |
| echo βοΈ Write JSON build spec file and release notes... | |
| echo "$json" | jq . > ${{ github.workspace }}/artifacts/buildspec.json | |
| shopt -s extglob | |
| echo "### SHA256 Checksums" > ${{ github.workspace }}/artifacts/CHECKSUMS.txt | |
| for file in ${{ github.workspace }}/artifacts/*.tar.gz; do | |
| echo " ${file##*/}: $(sha256sum "${file}" | cut -d " " -f 1)" >> ${{ github.workspace }}/artifacts/CHECKSUMS.txt | |
| done | |
| - name: π Upload | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: false | |
| prerelease: false | |
| name: Hyperion Deps Build ${{ github.ref_name }} | |
| tag_name: ${{ github.ref_name }} | |
| body_path: ${{ github.workspace }}/artifacts/CHECKSUMS.txt | |
| files: | | |
| ${{ github.workspace }}/artifacts/*.tar.gz | |
| ${{ github.workspace }}/artifacts/buildspec.json | |
| - name: π§Ή Cleanup | |
| uses: geekyeggo/delete-artifact@v5 | |
| with: | |
| name: | | |
| debian_* | |
| macos-* | |
| windows-* | |
| failOnError: false |