config_tab.py #54
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: Release | |
on: | |
pull_request: | |
types: [closed] | |
workflow_dispatch: | |
concurrency: | |
group: release | |
jobs: | |
release: | |
if: | | |
github.event_name != 'pull_request' || | |
( | |
github.event.pull_request.merged == true && | |
contains(github.event.pull_request.labels.*.name, 'release') | |
) | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup env | |
uses: ./.github/actions/setup_env | |
- name: Build & Zip exe | |
id: build_zip | |
shell: powershell | |
run: | | |
python build.py | |
$version = python -c "from src import __version__; print(__version__)" | |
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
$folderName = "d4lf_v" + $version | |
Compress-Archive -Path $folderName -DestinationPath "$folderName.zip" | |
- name: Create Tag | |
shell: powershell | |
run: | | |
git tag "v${{ env.VERSION }}" | |
git push origin "v${{ env.VERSION }}" | |
- name: Check if beta | |
id: check_beta | |
shell: powershell | |
run: | | |
if ("${{ env.VERSION }}".Contains("beta")) { | |
echo "IS_BETA=true" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 | |
} else { | |
echo "IS_BETA=false" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 | |
} | |
- name: Release | |
id: release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: d4lf_v*.zip | |
generate_release_notes: true | |
name: "v${{ env.VERSION }}" | |
prerelease: ${{ env.IS_BETA == 'true' }} | |
tag_name: "v${{ env.VERSION }}" | |
- name: Send message to Discord | |
shell: powershell | |
run: | | |
$webhookUrl = "${{ secrets.DISCORD_WEBHOOK }}" | |
$payload = @{ | |
username = "GitHub" | |
content = "**D4LF v${{ env.VERSION }}**`n`nRelease Page: <${{ steps.release.outputs.url }}>" | |
allowed_mentions = @{ | |
parse = @() | |
} | |
} | ConvertTo-Json | |
Invoke-RestMethod -Uri $webhookUrl -Method Post -ContentType "application/json" -Body $payload |