Skip to content

Commit

Permalink
fix: github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
derkalle4 committed Nov 7, 2024
1 parent ab7d261 commit 8d9af95
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- main
workflow_dispatch:

env:
REPOSITORY_NAME: "cs2-map-modifiers" # same as on github
REPOSITORY_FOLDER: "MapModifiers" # subfolder with source code

jobs:
create-release:
runs-on: ubuntu-latest
Expand All @@ -22,10 +26,10 @@ jobs:
- name: Install dependencies
run: dotnet restore

- name: Get current version from MapModifiers.cs
- name: Get current version from ${{ env.REPOSITORY_FOLDER }}.cs
id: get_version
run: |
version=$(grep -oP '(?<=ModuleVersion => ")[^"]*' MapModifiers/MapModifiers.cs)
version=$(grep -oP '(?<=ModuleVersion => ")[^"]*' ${{ env.REPOSITORY_FOLDER }}/${{ env.REPOSITORY_FOLDER }}.cs)
echo "version=$version" >> $GITHUB_ENV
- name: Get latest release version
Expand All @@ -50,11 +54,11 @@ jobs:
- name: Rename release directory
if: env.new_version == 'true'
run: |
mv /home/runner/work/cs2-map-modifiers/cs2-map-modifiers/MapModifiers/bin/Release/net8.0/publish/ /home/runner/work/cs2-map-modifiers/cs2-map-modifiers/MapModifiers/bin/Release/net8.0/MapModifiers/
mv /home/runner/work/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_FOLDER }}/bin/Release/net8.0/publish/ /home/runner/work/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_FOLDER }}/bin/Release/net8.0/${{ env.REPOSITORY_FOLDER }}/
- name: Zip release
if: env.new_version == 'true'
run: cd /home/runner/work/cs2-map-modifiers/cs2-map-modifiers/MapModifiers/bin/Release/net8.0 && zip -r /home/runner/work/cs2-map-modifiers-${{ env.version }}.zip MapModifiers
run: cd /home/runner/work/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_FOLDER }}/bin/Release/net8.0 && zip -r /home/runner/work/${{ env.REPOSITORY_NAME }}-${{ env.version }}.zip ${{ env.REPOSITORY_FOLDER }}

- name: Get release notes
if: env.new_version == 'true'
Expand Down Expand Up @@ -83,6 +87,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.UPLOAD_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /home/runner/work/cs2-map-modifiers-${{ env.version }}.zip
asset_name: cs2-map-modifiers-${{ env.version }}.zip
asset_path: /home/runner/work/{{ env.REPOSITORY_NAME }}-${{ env.version }}.zip
asset_name: ${{ env.REPOSITORY_NAME }}-${{ env.version }}.zip
asset_content_type: application/zip

0 comments on commit 8d9af95

Please sign in to comment.