Merge pull request #12 from Mythical-Github/dev #18
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: main_releases | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| check-bump: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| bump: ${{ steps.bump_check.outputs.bump }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Check for 'bump' in commit message | |
| id: bump_check | |
| run: | | |
| COMMIT_MSG="$(git log -1 --pretty=%B)" | |
| echo "Commit message: $COMMIT_MSG" | |
| if echo "$COMMIT_MSG" | grep -iq '\bbump\b'; then | |
| echo "bump=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "bump=false" >> $GITHUB_OUTPUT | |
| fi | |
| setup_ubuntu_x86_64: | |
| needs: check-bump | |
| if: needs.check-bump.outputs.bump != 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Python (x64) | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| architecture: "x64" | |
| - name: Install Hatch | |
| run: pip install hatch | |
| - name: Create Hatch virtual environment for x86_64-linux | |
| run: hatch env create x86_64-unknown-linux-gnu | |
| - name: Build Release | |
| run: hatch run py_project_dev_tools make_exe_release_ci_cd --os_arch_line "x86_64-unknown-linux-gnu" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ue4ss_installer_gui_x86_64-unknown-linux-gnu | |
| path: dist/ue4ss_installer_gui_x86_64-unknown-linux-gnu.zip | |
| setup_windows_x86_64: | |
| needs: check-bump | |
| if: needs.check-bump.outputs.bump != 'true' | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Python (x64) | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| architecture: "x64" | |
| - name: Install Hatch | |
| run: pip install hatch | |
| - name: Create Hatch virtual environment for x86_64-windows | |
| run: hatch env create x86_64-pc-windows-msvc | |
| - name: Build Release | |
| run: hatch run py_project_dev_tools make_exe_release_ci_cd --os_arch_line "x86_64-pc-windows-msvc" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ue4ss_installer_gui_x86_64-pc-windows-msvc | |
| path: dist/ue4ss_installer_gui_x86_64-pc-windows-msvc.zip | |
| bump_version: | |
| runs-on: ubuntu-latest | |
| needs: [setup_ubuntu_x86_64, setup_windows_x86_64] | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@v4 | |
| with: | |
| token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | |
| fetch-depth: 0 | |
| - name: Create bump and changelog | |
| uses: commitizen-tools/commitizen-action@master | |
| with: | |
| github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
| changelog_increment_filename: body.md | |
| - name: Create version.txt | |
| run: | | |
| echo "Revision: ${{ env.REVISION }}" > version.txt | |
| - name: Upload version.txt | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: version.txt | |
| path: version.txt | |
| - name: Upload changelog body.md | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: body.md | |
| path: body.md | |
| setup_github_releases: | |
| runs-on: ubuntu-latest | |
| needs: [bump_version] | |
| steps: | |
| - name: Download ubuntu_x86_64_artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ue4ss_installer_gui_x86_64-unknown-linux-gnu | |
| path: ./dist | |
| - name: Download windows_x86_64_artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ue4ss_installer_gui_x86_64-pc-windows-msvc | |
| path: ./dist | |
| - name: Download version.txt artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: version.txt | |
| - name: Read version from version.txt | |
| id: extract_version | |
| run: | | |
| # Read the contents of the downloaded version.txt file and extract the revision | |
| VERSION=$(cat version.txt | grep -oP 'Revision: \K.*') # Extract the version number after "Revision: " | |
| echo "Version extracted: $VERSION" | |
| echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Rename artifacts with version suffix | |
| run: | | |
| VERSION="${{ steps.extract_version.outputs.version }}" | |
| cd dist | |
| for FILE in ue4ss_installer_gui*.zip; do | |
| if [[ "$FILE" != *"$VERSION"* ]]; then | |
| BASE="${FILE%.zip}" | |
| # Replace underscores with hyphens and add version | |
| NEW_NAME=$(echo "$BASE" | sed 's/_/-/g')-"$VERSION".zip | |
| mv "$FILE" "$NEW_NAME" | |
| fi | |
| done | |
| - name: Generate SHA256 hashes for each file | |
| run: | | |
| cd dist | |
| # For each file in dist, generate its SHA256 hash and create a .sha256 file | |
| for FILE in *; do | |
| if [[ -f "$FILE" ]]; then | |
| # Generate SHA256 hash and save it to a .sha256 file | |
| sha256sum "$FILE" | awk '{print $1}' > "$FILE.sha256" | |
| fi | |
| done | |
| - name: List files in dist | |
| run: ls -R dist | |
| - name: Download body.md artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: body.md | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| body_path: "body.md" | |
| tag_name: ${{ steps.extract_version.outputs.version }} | |
| files: | | |
| dist/*.zip | |
| dist/*.sha256 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |