Release #127
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: | |
schedule: | |
- cron: "0 0 * * 0" # weekly | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- 'version' | |
jobs: | |
build: | |
runs-on: windows-latest | |
env: | |
MSYS2_PATH_TYPE: inherit | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: msys2/setup-msys2@v2 | |
with: | |
update: false | |
release: false | |
install: >- | |
zip | |
ninja | |
- uses: actions/checkout@v4 | |
- name: Get latest release | |
continue-on-error: true | |
id: cur_release | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
repository: ${{ github.repository }} | |
excludes: draft | |
- name: Get version | |
run: | | |
base_ver=$(cat version) | |
sha=${GITHUB_SHA::7} | |
prerelease=$([[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]] && echo true || echo false) | |
version=$([[ $prerelease == true ]] && echo ${base_ver}.$sha || echo ${base_ver}) | |
cur_ver=$([[ ${{ steps.cur_release.outcome }} == failure ]] && echo v0 || echo ${{ steps.cur_release.outputs.release }}) | |
[[ v$version == $cur_ver ]] && exit 1 | |
echo "version=$version" >> $GITHUB_ENV | |
echo "prerelease=$prerelease" >> $GITHUB_ENV | |
- name: Setup environment | |
shell: pwsh | |
run: | | |
.github/scripts/setenv.ps1 | |
echo $env:PATH | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Build | |
run: ninja -C build | |
- name: Create release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: v${{ env.version }} | |
name: ${{ env.version }} | |
draft: false | |
prerelease: ${{ env.prerelease }} | |
artifactErrorsFailBuild: true | |
artifacts: build/shimexe.zip | |
artifactContentType: application/zip | |
token: ${{ secrets.GITHUB_TOKEN }} |