nightly #884
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: nightly | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
checkver: | |
runs-on: ubuntu-latest | |
outputs: | |
new_version: ${{ steps.check_new_version.outputs.new_version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: Compare versions | |
run: python version_compare.py | |
- name: Check if new version exists | |
id: check_new_version | |
run: | | |
# If new.txt exists and is not empty | |
if [ -s "new.txt" ]; then | |
NEW_VERSION=$(cat new.txt) | |
echo "New version is $NEW_VERSION" | |
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
fi | |
build: | |
runs-on: windows-latest | |
needs: checkver | |
if: ${{ needs.checkver.outputs.new_version }} | |
strategy: | |
matrix: | |
arch: [x64, x86, arm64, arm] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: ${{ matrix.arch != 'x64' && 'amd64_' || '' }}${{ matrix.arch }} | |
- name: Build | |
run: python .\build.py | |
- name: Upload less to artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: less-${{ matrix.arch }} | |
path: | | |
less.exe | |
lesskey.exe | |
release: | |
needs: [checkver, build] | |
if: ${{ github.event_name != 'pull_request' }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
discussions: write | |
steps: | |
- name: Get all artifacts | |
uses: actions/download-artifact@v4 | |
- name: Zip each artifact | |
run: find . -type d ! -path . -execdir zip -9 -rj "{}.zip" "{}" \; | |
- uses: octokit/[email protected] | |
id: get_workflow_runtime | |
with: | |
route: GET /repos/{owner}/{repo}/actions/runs/{run_id} | |
owner: ${{ github.repository_owner }} | |
repo: less-Windows | |
run_id: ${{ github.run_id }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- id: extract_major_version | |
run: | | |
MAJOR_VERSION=$(echo ${{ needs.checkver.outputs.new_version }} | cut -d. -f1) | |
echo "major_version=$MAJOR_VERSION" >> $GITHUB_OUTPUT | |
- uses: softprops/action-gh-release@v2 | |
with: | |
files: '*.zip' | |
body: | | |
Built with GitHub Actions at ${{ fromJson(steps.get_workflow_runtime.outputs.data).updated_at }} | |
Release notes can be found [here](http://greenwoodsoftware.com/less/news.${{ steps.extract_major_version.outputs.major_version }}.html). | |
tag_name: less-v${{ needs.checkver.outputs.new_version }} | |
discussion_category_name: Announcements | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
winget: | |
name: Publish to WinGet | |
needs: [checkver, release] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: vedantmgoyal9/winget-releaser@main | |
with: | |
identifier: jftuga.less | |
version: ${{ needs.checkver.outputs.new_version }} | |
release-tag: less-v${{ needs.checkver.outputs.new_version }} | |
installers-regex: '\.zip$' | |
token: ${{ secrets.WINGET_TOKEN }} |