Release watchtower #8564
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 watchtower | |
on: | |
push: | |
schedule: | |
- cron: '0 */3 * * *' | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.latest.outputs.ver }} | |
need_build: ${{ steps.check.outputs.exists == 'false' }} | |
steps: | |
- name: Get latest tag | |
id: latest | |
run: | | |
VERSION=$( | |
curl -sL 'https://api.github.com/repos/gwsw/less/git/refs/tags' | | |
jq -r '.[-1].ref' | | |
sed 's|^refs/tags/v||' | | |
grep -Eo '^[0-9]+$' | |
) | |
echo "ver=${VERSION}" >> "$GITHUB_OUTPUT" | |
- name: Check if the tag already exists | |
uses: mukunku/tag-exists-action@v1.5.0 | |
id: check | |
with: | |
tag: v${{ steps.latest.outputs.ver }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
prepare: | |
runs-on: ubuntu-latest | |
needs: [check] | |
if: needs.check.outputs.need_build == 'true' | |
outputs: | |
version: ${{ needs.check.outputs.version }} | |
upload_url: ${{ steps.new_release.outputs.upload_url }} | |
steps: | |
- name: Publish new release | |
id: new_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ needs.check.outputs.version }} | |
release_name: v${{ needs.check.outputs.version }} | |
body: | | |
This build is automated via GitHub Actions. | |
If you find any errors, please open an issue and let me know. | |
> Outputs will be available later because we're building binary sequentially by arch after publishing the release. | |
draft: false | |
prerelease: false | |
build: | |
runs-on: ubuntu-22.04 | |
needs: [prepare] | |
steps: | |
- run: | | |
sudo apt-get install -y musl-tools make autoconf libncurses-dev | |
curl -L 'https://github.com/gwsw/less/archive/v${{ needs.prepare.outputs.version }}.tar.gz' | tar --strip-components=1 -zx | |
make -f Makefile.aut | |
CFLAGS=-Os LDFLAGS=-static ./configure | |
CC=musl-gcc make -j | |
strip less lessecho lesskey | |
- uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.prepare.outputs.upload_url }} | |
asset_path: ./less | |
asset_name: less | |
asset_content_type: application/octet-stream | |
- uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.prepare.outputs.upload_url }} | |
asset_path: ./lesskey | |
asset_name: lesskey | |
asset_content_type: application/octet-stream | |
- uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.prepare.outputs.upload_url }} | |
asset_path: ./lessecho | |
asset_name: lessecho | |
asset_content_type: application/octet-stream |