Update st.ps1 #34
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 | |
permissions: | |
contents: write | |
actions: read | |
on: | |
push: | |
branches: | |
- main # Or whichever branch you want to track | |
jobs: | |
build-runspace: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set Version to Todays Date | |
id: extract_version | |
run: | | |
$version = (Get-Date -Format "yy.MM.dd") | |
echo "VERSION=$version" >> $env:GITHUB_ENV | |
shell: pwsh | |
- name: Create Tag | |
id: create_tag | |
run: | | |
$tagExists = git tag -l $env:VERSION | |
if ($tagExists -eq "") { | |
git tag $env:VERSION | |
if ($LASTEXITCODE -ne 0) { | |
Write-Error "Failed to create tag $env:VERSION" | |
exit 1 | |
} | |
git push origin $env:VERSION | |
if ($LASTEXITCODE -ne 0) { | |
Write-Error "Failed to push tag $env:VERSION" | |
exit 1 | |
} | |
} else { | |
Write-Host "Tag $env:VERSION already exists, skipping tag creation" | |
} | |
shell: pwsh | |
- name: Upload st.ps1 as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: shelltube | |
path: ./st.ps1 | |
- name: Generate Release Notes | |
id: generate_notes | |
uses: release-drafter/release-drafter@v6 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
config-name: release-drafter.yml | |
version: ${{ env.VERSION }} # Pass the version variable | |
- name: Create and Upload Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.VERSION }} | |
name: Release ${{ env.VERSION }} | |
body: | | |
${{ steps.generate_notes.outputs.body }} | |
append_body: false | |
files: ./st.ps1 | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |