From 98658fc0c24b58a57eaa1ab7cc8859bd5e13cee4 Mon Sep 17 00:00:00 2001 From: MiszczuZPolski <71414303+MiszczuZPolski@users.noreply.github.com> Date: Tue, 30 May 2023 18:54:18 +0200 Subject: [PATCH] Tools - Add auto-upload workflow for release (#328) **When merged this pull request will:** - Title I hate workflows and testing it ### IMPORTANT - [x] [Development Guidelines](https://ace3.acemod.org/wiki/development/) are read, understood and applied. - [x] Title of this PR uses our standard template `Component - Add|Fix|Improve|Change|Make|Remove {changes}`. --- .editorconfig | 2 +- .github/workflows/documentation.yml | 15 +++++-- .github/workflows/release-drafter.yml | 16 -------- .github/workflows/release.yml | 56 +++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 20 deletions(-) delete mode 100644 .github/workflows/release-drafter.yml create mode 100644 .github/workflows/release.yml diff --git a/.editorconfig b/.editorconfig index af1c2ff31..353038b72 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,4 +9,4 @@ indent_size = 4 trim_trailing_whitespace = true [*.md] -trim_trailing_whitespace = false +trim_trailing_whitespace = false \ No newline at end of file diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 906e3dd78..f6d137067 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -3,9 +3,8 @@ name: Documentation on: push: branches: - - master - workflow_dispatch: - + - master + jobs: update: runs-on: ubuntu-latest @@ -23,3 +22,13 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: python3 tools/deploy.py + + draft: + runs-on: ubuntu-latest + steps: + - name: Release Drafter + if: github.repository == 'KAT-Advanced-Medical/KAM' + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml deleted file mode 100644 index c7e3b6442..000000000 --- a/.github/workflows/release-drafter.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Release Drafter - -on: - push: - branches: - - dev-Tomcat - -jobs: - draft: - runs-on: ubuntu-latest - steps: - - name: Release Drafter - if: github.repository == 'KAT-Advanced-Medical/KAM' - uses: release-drafter/release-drafter@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..ac7554862 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: Release + +on: + release: + types: released + +permissions: + contents: write + +jobs: + release-addon: + runs-on: ubuntu-latest + steps: + - name: Set VERSION env + run: echo VERSION=${GITHUB_REF:11} >> $GITHUB_ENV + - name: Checkout the source code + uses: actions/checkout@v2 + - name: Setup HEMTT + uses: arma-actions/hemtt@v1 + - name: Run HEMTT build + run: hemtt release + - name: Move release to releases folder + run: + version="${{ github.event.release.tag_name }}" + mv releases/kat-latest.zip "@Kat-Advanced-Medical-${{ env.VERSION }}.zip" + - name: Update Release with Files + uses: softprops/action-gh-release@v1 + with: + files: ./@Kat-Advanced-Medical-*.zip + draft: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Update to Steam Workshop (stable) + uses: arma-actions/workshop-upload@v1 + with: + itemId: '2020940806' + contentPath: './@Kat-Advanced-Medical-*.zip' + changelog: | + https://github.com/KAT-Advanced-Medical/KAM/releases/tag/v${{ env.VERSION }} + + ${{ github.event.release.body }} + env: + STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }} + STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }} + - name: Update to Steam Workshop (dev) + uses: arma-actions/workshop-upload@v1 + with: + itemId: '2774641073' + contentPath: './@Kat-Advanced-Medical-*.zip' + changelog: | + https://github.com/KAT-Advanced-Medical/KAM/releases/tag/v${{ env.VERSION }} + + ${{ github.event.release.body }} + env: + STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }} + STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}