Update fivem-release.yml #3
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
| workflow_call: | ||
| permissions: | ||
| contents: write | ||
| jobs: | ||
| build-release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Get Repository Name | ||
| id: repo_name | ||
| run: echo "repo_name=${GITHUB_REPOSITORY#*/}" >> $GITHUB_OUTPUT | ||
| - name: Get Version from fxmanifest | ||
| id: get_version | ||
| run: | | ||
| VERSION=$(grep -E "version ['\"][0-9]+\.[0-9]+\.[0-9]+['\"]" fxmanifest.lua | sed -E "s/.*version ['\"]([0-9]+\.[0-9]+\.[0-9]+)['\"].*/\1/") | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| - name: Create Escrow Version | ||
| run: | | ||
| # Create a temp directory for building the zip | ||
| TEMP_DIR="$(pwd)/temp_build_dir" | ||
| mkdir -p "$TEMP_DIR/${{ steps.repo_name.outputs.repo_name }}" | ||
| # Copy files to the folder structure | ||
| rsync -av --exclude='.git/' --exclude='.github/' --exclude='.vscode/' --exclude='*.zip' --exclude='temp_build_dir/' ./ "$TEMP_DIR/${{ steps.repo_name.outputs.repo_name }}/" | ||
| # Create zip | ||
| cd "$TEMP_DIR" | ||
| zip -r "${{ steps.repo_name.outputs.repo_name }}_escrow.zip" "${{ steps.repo_name.outputs.repo_name }}" | ||
| # Move the zip back to workspace | ||
| mv "${{ steps.repo_name.outputs.repo_name }}_escrow.zip" "$GITHUB_WORKSPACE/" | ||
| # Clean up | ||
| cd "$GITHUB_WORKSPACE" | ||
| rm -rf "$TEMP_DIR" | ||
| - name: Create Open Source Version | ||
| run: | | ||
| # Create a temp directory for building the zip | ||
| TEMP_DIR="$(pwd)/temp_build_dir" | ||
| mkdir -p "$TEMP_DIR/${{ steps.repo_name.outputs.repo_name }}" | ||
| # Copy files to the folder structure | ||
| rsync -av --exclude='.git/' --exclude='.github/' --exclude='.vscode/' --exclude='*.zip' --exclude='temp_build_dir/' ./ "$TEMP_DIR/${{ steps.repo_name.outputs.repo_name }}/" | ||
| # Create zip | ||
| cd "$TEMP_DIR" | ||
| zip -r "${{ steps.repo_name.outputs.repo_name }}_opensource.zip" "${{ steps.repo_name.outputs.repo_name }}" | ||
| # Move the zip back to workspace | ||
| mv "${{ steps.repo_name.outputs.repo_name }}_opensource.zip" "$GITHUB_WORKSPACE/" | ||
| # Clean up | ||
| cd "$GITHUB_WORKSPACE" | ||
| rm -rf "$TEMP_DIR" | ||
| - name: Generate Release Tag | ||
| id: tag | ||
| run: echo "release_tag=v${{ steps.get_version.outputs.version }}" >> $GITHUB_OUTPUT | ||
| - name: Create Release | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| tag_name: ${{ steps.tag.outputs.release_tag }} | ||
| files: | | ||
| ${{ steps.repo_name.outputs.repo_name }}_escrow.zip | ||
| ${{ steps.repo_name.outputs.repo_name }}_opensource.zip | ||