Repository navigation
release #82
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 | |
| # One release per version of a rebuilt client. The tag is the build folder | |
| # and the version, e.g. graal-2.05r2-GNW03081-v0.0.1, so a build can be | |
| # recompiled and released again as it learns more. This builds that folder | |
| # on Linux and Windows and makes a DRAFT release with the binaries | |
| # attached and the folder's RELEASE_NOTES.md as its text; Squirrel reviews | |
| # it and presses Publish (the suite-wide rule in seihai RELEASES.md). | |
| # Start it from the Actions tab with the folder name and version, or by | |
| # pushing a tag of that form. | |
| on: | |
| push: | |
| tags: ['graal-*-v*'] | |
| workflow_dispatch: | |
| inputs: | |
| build: | |
| description: Build folder to release, e.g. graal-2.05r2-GNW03081 | |
| required: true | |
| version: | |
| description: Version, e.g. v0.0.1 | |
| required: true | |
| default: v0.0.1 | |
| macos: | |
| description: Build macOS too (off; macOS is dropped for now) | |
| type: choice | |
| options: ['yes', 'no'] | |
| default: 'no' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Linux and Windows; macOS only when a manual run asks for it, so a | |
| # macOS runner that never comes cannot hold up a release | |
| os: ${{ fromJSON(inputs.macos == 'yes' && '["ubuntu-latest","windows-latest","macos-latest"]' || '["ubuntu-latest","windows-latest"]') }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Name the build and version | |
| shell: bash | |
| env: | |
| IN_BUILD: ${{ inputs.build }} | |
| IN_VERSION: ${{ inputs.version }} | |
| TAG: ${{ github.ref_name }} | |
| run: | | |
| if [ -n "$IN_BUILD" ]; then B="$IN_BUILD"; V="$IN_VERSION" | |
| else B="${TAG%-v*}"; V="v${TAG##*-v}"; fi | |
| test -d "$B/src" | |
| test -f "$B/RELEASE_NOTES.md" | |
| echo "BUILD=$B" >> "$GITHUB_ENV" | |
| echo "VERSION=$V" >> "$GITHUB_ENV" | |
| - name: Install Free Pascal (Linux) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y fp-compiler fp-units-base fp-units-fcl libx11-dev | |
| - name: Install Free Pascal (Windows) | |
| if: runner.os == 'Windows' | |
| run: choco install freepascal -y --no-progress | |
| - name: Install Free Pascal (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install fpc | |
| - name: Build and test | |
| shell: bash | |
| run: | | |
| if [ "$RUNNER_OS" = Windows ]; then | |
| export PATH="$(ls -d /c/tools/freepascal/bin/* | head -1):$PATH" | |
| export FPCFLAGS='-O2 -FuC:\tools\freepascal\units\i386-win32\*' | |
| fi | |
| scripts/build.sh "$BUILD" | |
| scripts/test.sh | |
| - name: Pack | |
| shell: bash | |
| run: | | |
| OUT="$BUILD-$VERSION-${RUNNER_OS,,}" | |
| mkdir -p "dist/$OUT" | |
| for F in build/"$BUILD"/*; do | |
| case "$F" in *.o|*.ppu|*.a|*.bmp|*.heap) ;; *) [ -f "$F" ] && [ -x "$F" -o "${F##*.}" = exe ] && cp "$F" "dist/$OUT/";; esac | |
| done | |
| cp "$BUILD/README.md" "$BUILD/RELEASE_NOTES.md" "dist/$OUT/" | |
| cd dist && 7z a "$OUT.zip" "$OUT" > /dev/null | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ runner.os }} | |
| path: dist/*.zip | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Name the build and version | |
| env: | |
| IN_BUILD: ${{ inputs.build }} | |
| IN_VERSION: ${{ inputs.version }} | |
| TAG: ${{ github.ref_name }} | |
| run: | | |
| if [ -n "$IN_BUILD" ]; then B="$IN_BUILD"; V="$IN_VERSION" | |
| else B="${TAG%-v*}"; V="v${TAG##*-v}"; fi | |
| echo "BUILD=$B" >> "$GITHUB_ENV" | |
| echo "VERSION=$V" >> "$GITHUB_ENV" | |
| # the title is the notes' first heading plus the version | |
| echo "TITLE=$(head -1 "$B/RELEASE_NOTES.md" | sed 's/^# *//') $V" >> "$GITHUB_ENV" | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.BUILD }}-${{ env.VERSION }} | |
| name: ${{ env.TITLE }} | |
| body_path: ${{ env.BUILD }}/RELEASE_NOTES.md | |
| target_commitish: ${{ github.sha }} | |
| draft: true | |
| files: dist/**/*.zip |