|
| 1 | +name: Combine Zip Files |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: # Allows manual triggering of the workflow |
| 5 | + |
| 6 | +jobs: |
| 7 | + combine: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + |
| 10 | + steps: |
| 11 | + - name: Checkout code |
| 12 | + uses: actions/checkout@v4 |
| 13 | + |
| 14 | + - name: Find highest version number |
| 15 | + id: find_version |
| 16 | + run: | |
| 17 | + # Extract version numbers from directory names and find the highest |
| 18 | + highest_version=$(ls -d */ | grep -oP '^\d+\.\d+' | sort -V | tail -n 1) |
| 19 | + echo "Highest version found: $highest_version" |
| 20 | + echo "highest_version=$highest_version" >> $GITHUB_ENV # Set output using environment file |
| 21 | +
|
| 22 | + - name: Find the actual directory name |
| 23 | + id: find_directory |
| 24 | + run: | |
| 25 | + # Find the actual directory name that matches the highest version |
| 26 | + dir_name=$(ls -d "${{ env.highest_version }} "* | head -n 1) |
| 27 | + echo "Directory name found: $dir_name" |
| 28 | + echo "dir_name=$dir_name" >> $GITHUB_ENV # Set output using environment file |
| 29 | +
|
| 30 | + - name: Combine Zip Files |
| 31 | + id: combine_zip |
| 32 | + run: | |
| 33 | + cd "${{ env.dir_name }}" || exit 1 |
| 34 | + # Combine split zip files |
| 35 | + combined_zip_name="thmj4n ${{ env.highest_version }}.zip" |
| 36 | + cat thmj4n.zip.* > "$combined_zip_name" |
| 37 | + echo "Combined zip file created: $combined_zip_name" |
| 38 | + echo "combined_zip_name=$combined_zip_name" >> $GITHUB_ENV # Set output using environment file |
| 39 | +
|
| 40 | + - name: Upload Combined Zip as Artifact |
| 41 | + id: upload_artifact |
| 42 | + uses: actions/upload-artifact@v4 |
| 43 | + with: |
| 44 | + name: "combined-zip-${{ env.highest_version }}" |
| 45 | + path: "${{ env.dir_name }}/${{ env.combined_zip_name }}" # Path to the combined zip file |
| 46 | + retention-days: 3 # Set the artifact to expire in 3 days (max 90 days) |
| 47 | + |
| 48 | + - name: Create Release and Upload Asset |
| 49 | + id: create_release |
| 50 | + uses: softprops/action-gh-release@v1 |
| 51 | + with: |
| 52 | + tag_name: ${{ env.highest_version }} # Use the highest version as the tag |
| 53 | + name: "Release ${{ env.highest_version }}" # Set the release name |
| 54 | + body: "This release includes the combined zip file for version ${{ env.highest_version }}." |
| 55 | + files: "${{ env.dir_name }}/${{ env.combined_zip_name }}" # Path to the combined zip file |
| 56 | + env: |
| 57 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments