Merge branch 'exit' of https://github.com/oscar-wos/AntiRush into exit #28
Workflow file for this run
This file contains 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: Build and Release | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout all the submodules | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build -c Release | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build -c Release | |
- name: Create Directories | |
run: | | |
mkdir -p plugin/plugins/${{ github.event.repository.name }} | |
mkdir -p plugin/shared/Menu | |
- name: Move Files | |
run: | | |
mv ./src/bin/Release/net8.0/* plugin/plugins/${{ github.event.repository.name }} | |
mv ./Menu/src/bin/Release/net8.0/* plugin/shared/Menu | |
- name: Remove .API | |
run: | | |
rm plugin/plugins/${{ github.event.repository.name }}/Menu.* | |
- name: Zip | |
run: | | |
cd plugin/ | |
zip -r ${{ github.event.repository.name }}-${{ github.sha }}.zip . | |
- name: Extract version | |
id: extract_version | |
run: | | |
version=$(grep -oP 'public override string ModuleVersion => "\K(.*)(?=";)' ./src/Globals.cs) | |
echo "::set-output name=version::$version" | |
- name: Publish | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }}-${{ github.sha }} | |
path: plugin | |
- name: Create Tag | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git tag ${{ env.version }} | |
git push origin ${{ env.version }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.extract_version.outputs.version }} | |
release_name: ${{ steps.extract_version.outputs.version }} | |
body: | | |
This is an automated release. | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload_release_asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./plugin/${{ github.event.repository.name }}-${{ github.sha }}.zip | |
asset_name: ${{ github.event.repository.name }}.zip | |
asset_content_type: application/zip |