Skip to content

Release

Release #120

Workflow file for this run

name: Release
on:
schedule:
- cron: "0 0 * * 0" # weekly
workflow_dispatch:
push:
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@v2
- 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}
version=$([ -z "${{ github.event.schedule }}" ] && echo ${base_ver} || echo ${base_ver}.$sha)
cur_ver=$([[ ${{ steps.cur_release.outcome }} == failure ]] && echo v0 || echo ${{ steps.cur_release.outputs.release }})
[[ v$version == $cur_ver ]] && exit 1
prerelease=$([ -z "${{ github.event.schedule }}" ] && echo false || echo true)
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 }}