fix release workflow #10
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: Release | ||
on: | ||
release: | ||
types: [created] | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: "8.x" | ||
- name: Display dotnet version | ||
run: dotnet --version | ||
- name: Compile | ||
run: make | ||
- name: Zip rules directory | ||
run: | | ||
mkdir MxLintExtension | ||
cp -r bin/Debug/net8.0/* MxLintExtension | ||
zip -r extension.zip MxLintExtension | ||
- name: Get release | ||
id: get_release | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const release = await github.rest.repos.getRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
release_id: context.payload.release.id | ||
}); | ||
core.setOutput('upload_url', release.data.upload_url); | ||
core.setOutput('tag_name', release.data.tag_name); | ||
- name: Upload Release Asset (ZIP) | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
with: | ||
upload_url: ${{ steps.get_release.outputs.upload_url }} | ||
asset_path: ./extension.zip | ||
asset_name: MxLintExtension-${{ steps.get_release.outputs.tag_name}}.zip | ||
asset_content_type: application/zip | ||