Merge branch 'Mission-1' of https://github.com/NotCallMeHacker/ARRC i… #62
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: Package Mission | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| paths-ignore: | |
| - 'export/**' | |
| release: | |
| types: [created,edited] | |
| permissions: | |
| contents: write | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Missions | |
| uses: actions/checkout@v4 | |
| - name: Get and Transform Version | |
| if: github.event_name == 'release' | |
| id: version | |
| run: | | |
| TAG=${{ github.event.release.tag_name }} | |
| CLEAN_VERSION=$(echo "$TAG" | sed -E ' | |
| s/^v//; | |
| s/([0-9]+)\.([0-9]+)\.([0-9]+)/\1\2\3/; | |
| s/\+.*//; | |
| s/-/_/; | |
| s/^/v/ | |
| ') | |
| echo "version=$CLEAN_VERSION" >> $GITHUB_OUTPUT | |
| echo "Original tag: $TAG → Clean version: $CLEAN_VERSION" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: robinraju/release-downloader@v1.7 | |
| with: | |
| repository: "German-Rangers-MM/PBO-Packer" | |
| latest: true | |
| fileName: "pbo-packer" | |
| - name: Package Missions | |
| run: | | |
| # Remove existing export files to ensure clean replacement | |
| rm -rf export | |
| mkdir -p export | |
| chmod +x ./pbo-packer | |
| ./pbo-packer . ./export | |
| # Rename files with version only for releases | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| for pbo in ./export/*.pbo; do | |
| base=$(basename "$pbo") | |
| mission_name="${base%%.*}" | |
| map_ext="${base#*.}" | |
| map_name="${map_ext%.*}" | |
| ext="${pbo##*.}" | |
| new_name="${mission_name}_${{ steps.version.outputs.version }}.${map_name}.${ext}" | |
| mv "$pbo" "./export/$new_name" | |
| done | |
| fi | |
| # Write to workflow summary | |
| echo "### 🚀 Packed Missions" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| echo "**Version:** ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "**Version:** Latest (Push)" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Mission File | Size |" >> $GITHUB_STEP_SUMMARY | |
| echo "|--------------|------|" >> $GITHUB_STEP_SUMMARY | |
| for pbo in ./export/*.pbo; do | |
| size=$(ls -lh $pbo | awk '{print $5}') | |
| filename=$(basename "$pbo") | |
| echo "| \`$filename\` | $size |" >> $GITHUB_STEP_SUMMARY | |
| done | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Total missions:** $(ls ./export/*.pbo | wc -l)" >> $GITHUB_STEP_SUMMARY | |
| echo "Packed and tagged missions:" | |
| ls -lh ./export/ | |
| - name: Commit and Push Packaged Files | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add ./export/*.pbo | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit." | |
| else | |
| git commit -m "chore: add packaged mission files [ci skip]" | |
| git push | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |