From 77c3b0d67a7a04b69d61800a955fa858a69610c0 Mon Sep 17 00:00:00 2001 From: hizumi <> Date: Thu, 22 Feb 2024 23:12:27 -0600 Subject: [PATCH] update workflows with new formatting and urls --- ...sting-snapshot.yaml => on-push-devel.yaml} | 2 +- .gitea/workflows/on-release.yaml | 68 ++++++++++ .gitea/workflows/pack-zgm-pbo-files.yaml | 124 ------------------ 3 files changed, 69 insertions(+), 125 deletions(-) rename .gitea/workflows/{create-testing-snapshot.yaml => on-push-devel.yaml} (99%) create mode 100644 .gitea/workflows/on-release.yaml delete mode 100644 .gitea/workflows/pack-zgm-pbo-files.yaml diff --git a/.gitea/workflows/create-testing-snapshot.yaml b/.gitea/workflows/on-push-devel.yaml similarity index 99% rename from .gitea/workflows/create-testing-snapshot.yaml rename to .gitea/workflows/on-push-devel.yaml index 5fb5877..32ca8c6 100644 --- a/.gitea/workflows/create-testing-snapshot.yaml +++ b/.gitea/workflows/on-push-devel.yaml @@ -62,7 +62,7 @@ jobs: Invoke-WebRequest -Uri "${{ gitea.api_url }}/repos/${{ gitea.repository }}/tags" -Method Post -Headers $headers -ContentType "application/json" -Body "{`"message`": `"testing-release`", `"tag_name`": `"testing-release`", `"target`": `"${{ gitea.sha }}`"}" - name: Create new testing-release - uses: https://gitea.com/actions/gitea-release-action@v1.1.6 + uses: https://gitea.com/actions/gitea-release-action@v1.3.0 with: tag_name: 'testing-release' name: 'testing-release' diff --git a/.gitea/workflows/on-release.yaml b/.gitea/workflows/on-release.yaml new file mode 100644 index 0000000..4acdbca --- /dev/null +++ b/.gitea/workflows/on-release.yaml @@ -0,0 +1,68 @@ +name: Pack Release files +on: + release: + types: [published] + +jobs: + DispatchZGMBuild: + name: Dispatch MissionZGM build job + runs-on: windows + steps: + - name: Diagnostics + run: | + echo "repository: ${{ gitea.repository }}" + echo "ref: ${{ gitea.ref }}" + echo "ref_name: ${{ gitea.ref_name }}" + echo "sha: ${{ gitea.sha }}" + echo "api_url: ${{ gitea.api_url }}" + echo "workflow: ${{ gitea.workflow }}" + - name: Publish remote issue + run: | + $headers = @{ + "accept" = "application/json" + "Authorization" = "token ${{ secrets.RUNNER_ISSUE_TOKEN }}" + } + $response = Invoke-RestMethod -Uri "${{ gitea.api_url }}/repos17th-Ranger-Battalion-ORG/MissionsForZGM/issues" -Method Post -Headers $headers -ContentType "application/json" -Body "{`"title`": `"publish-release`"}" + + CreateRelease: + name: Publish cleaned template + runs-on: windows + steps: + - name: Diagnostics + run: | + echo "repository: ${{ gitea.repository }}" + echo "ref: ${{ gitea.ref }}" + echo "ref_name: ${{ gitea.ref_name }}" + echo "sha: ${{ gitea.sha }}" + echo "api_url: ${{ gitea.api_url }}" + echo "workflow: ${{ gitea.workflow }}" + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: 'main' + path: release + + - name: Prepare template + run: | + mkdir MissionTemplate + cd MissionTemplate + Get-ChildItem ..\release\ | Copy-Item -Recurse + Remove-Item -Recurse aaFrameworkUtils + Remove-Item -Recurse framework\x + Remove-Item -Recurse .git* + Get-ChildItem + + - name: Create archive + run: | + $revision = git rev-parse --short=10 HEAD + cd MissionTemplate + $tag = git describe --abbrev=0 --tags + Compress-Archive MissionFramework mission-maker-template-v$tag-$revision.zip + + - name: Add archive to release + uses: https://gitea.com/actions/gitea-release-action@v1.3.0 + with: + files: |- + mission-maker-template*.zip diff --git a/.gitea/workflows/pack-zgm-pbo-files.yaml b/.gitea/workflows/pack-zgm-pbo-files.yaml deleted file mode 100644 index 4c6673a..0000000 --- a/.gitea/workflows/pack-zgm-pbo-files.yaml +++ /dev/null @@ -1,124 +0,0 @@ -name: Pack ZGM mission PBO files -on: - push: - branches: [main] - -jobs: - GetMissionList: - name: Get ZGM mission list - runs-on: windows - steps: - - name: Diagnostics - run: | - echo "repository: ${{ gitea.repository }}" - echo "ref: ${{ gitea.ref }}" - echo "ref_name: ${{ gitea.ref_name }}" - echo "sha: ${{ gitea.sha }}" - echo "api_url: ${{ gitea.api_url }}" - echo "workflow: ${{ gitea.workflow }}" - - - name: Checkout missions - uses: actions/checkout@v3 - with: - repository: 17th-Ranger-Battalion-ORG/MissionsForZGM - fetch-depth: 0 - ref: 'main' - token: ${{ secrets.RELEASE_TOKEN }} - - - name: Get current directory list - run: | - Get-ChildItem - - - name: Get mission list - run: | - Get-ChildItem MissionsForZGM/* - - CreatePboFiles: - name: Create PBO files - runs-on: windows - steps: - - name: Diagnostics - run: | - echo "repository: ${{ gitea.repository }}" - echo "ref: ${{ gitea.ref }}" - echo "ref_name: ${{ gitea.ref_name }}" - echo "sha: ${{ gitea.sha }}" - echo "api_url: ${{ gitea.api_url }}" - echo "workflow: ${{ gitea.workflow }}" - - - name: Checkout template - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: 'main' - token: ${{ secrets.RELEASE_TOKEN }} - path: template - - - name: Prepare template - run: | - Remove-Item -Recurse template\aaFrameworkUtils - Remove-Item -Recurse template\framework\x - Remove-Item -Recurse template\.git* - - - name: Checkout missions - uses: actions/checkout@v3 - with: - repository: 17th-Ranger-Battalion-ORG/MissionsForZGM - fetch-depth: 0 - ref: 'main' - token: ${{ secrets.RELEASE_TOKEN }} - path: zgm-files - - - name: Get mission list - run: | - Get-ChildItem - - - name: Get mission list - run: | - Get-ChildItem zgm-files - - - name: Prepare tools - run: | - mkdir packed-files - Remove-Item -Recurse template\.git - - - name: Pack PBOs - run: | - $date = Get-Date -Format "yyyy-MM-dd" - foreach ($file in Get-ChildItem zgm-files\missions) { - $map = (Get-Item zgm-files\missions\$file).Basename.split('\.')[-1] - Copy-Item zgm-files\missions\$file\mission.sqm template\ - (Get-Content .\template\mission_settings.hpp).Replace("MISSION AUTHOR","17th Ranger Battalion") | Set-Content .\template\mission_settings.hpp - (Get-Content .\template\mission_settings.hpp).Replace("THIS APPEARS ON TOP OF THE LOADING SCREEN IMAGE","GAME MASTER") | Set-Content .\template\mission_settings.hpp - (Get-Content .\template\mission_settings.hpp).Replace("THIS APPEARS BELOW THE LOADING SCREEN IMAGE","Forcing you to respawn since 2013") | Set-Content .\template\mission_settings.hpp - (Get-Content .\template\mission_settings.hpp).Replace("THIS IS THE NAME ON THE #MISSIONS LIST","BASE ZGM $date") | Set-Content .\template\mission_settings.hpp - (Get-Content .\template\mission_settings.hpp).Replace("THIS IS WHERE YOU DESCRIBE THE MISSION IN THE #MISSION LIST","I have 2 headless clients, and am most likely an airfield spawn") | Set-Content .\template\mission_settings.hpp - (Get-Content .\template\mission_settings.hpp).Replace("MY SERIES NAME","ZEUS GAME MASTER") | Set-Content .\template\mission_settings.hpp - - $missionName = Get-Content .\template\mission.sqm | Select-String -Pattern 'sourceName="(.*)";' - $missionName = $missionName.Matches.groups[1].value - (Get-Content .\template\mission.sqm).Replace($missionName,"FRAMEWORK ZGM $date") | Set-Content .\template\mission.sqm - - zgm-files\tools\PBOconsole.exe -pack template packed-files\BASE_ZGM_$date.$map.pbo - } - - - name: List PBOs - run: | - cd packed-files - Get-ChildItem - - - name: Backup artifacts from runner - uses: actions/upload-artifact@v3 - with: - name: zgm-pbo-files - path: packed-files/* - - - name: Create release - uses: https://gitea.com/actions/gitea-release-action@v1.1.6 - with: - tag_name: 'snapshot-release' - release_name: 'snapshot-release' - files: |- - packed-files/** - api_key: '${{secrets.RELEASE_TOKEN}}' -