This repository has been archived by the owner on Sep 2, 2024. It is now read-only.
CI #691
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: CI | |
# We intentionally choose an older version of Ubuntu to make the binary depend on an older version of glibc | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 3 * * *' # 3:00 AM every night | |
jobs: | |
check: | |
runs-on: ubuntu-20.04 | |
outputs: | |
changes_detected: ${{ steps.auto-commit-action.outputs.changes_detected }} | |
commit_hash: ${{ steps.auto-commit-action.outputs.commit_hash }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Detect latest version | |
run: | | |
FAVA_VERSION=$(curl "https://pypi.org/rss/project/fava/releases.xml" | python3 -c "import sys, re; sys.stdout.write(re.search('<title>([0-9\\.]+)</title>', sys.stdin.read())[1])") | |
echo "Latest version: $FAVA_VERSION" | |
echo "$FAVA_VERSION" > FAVA_VERSION | |
echo "FAVA_VERSION=$FAVA_VERSION" >> ${{ github.env }} | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
id: auto-commit-action | |
name: "Update FAVA_VERSION file" | |
with: | |
commit_message: Bump fava to ${{ env.FAVA_VERSION }} | |
build: | |
needs: [ check ] | |
if: needs.check.outputs.changes_detected == 'true' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: macos-latest | |
tag: darwin-amd64 | |
- os: ubuntu-20.04 | |
tag: linux-amd64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.check.outputs.commit_hash }} | |
- run: echo "FAVA_VERSION=$(cat FAVA_VERSION)" >> ${{ github.env }} | |
- name: Build | |
run: | | |
./build.sh | |
cd dist && zip -r fava-${{ env.FAVA_VERSION }}-${{ github.run_id }}-${{ matrix.tag }}.zip . | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.tag }} | |
path: dist/*.zip | |
build-linux-arm64: | |
needs: [ check ] | |
if: needs.check.outputs.changes_detected == 'true' | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.check.outputs.commit_hash }} | |
- run: echo "FAVA_VERSION=$(cat FAVA_VERSION)" >> ${{ github.env }} | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Build | |
with: | |
arch: aarch64 | |
distro: ubuntu20.04 | |
githubToken: ${{ github.token }} | |
dockerRunArgs: --volume "${PWD}:/src" | |
install: | | |
apt-get update -q -y | |
apt-get install -q -y python3 python3-pip python3-venv zip | |
run: | | |
cd /src | |
FAVA_VERSION=${{ env.FAVA_VERSION }} ./build.sh | |
cd dist && zip -r fava-${{ env.FAVA_VERSION }}-${{ github.run_id }}-linux-arm64.zip . | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: linux-arm64 | |
path: dist/*.zip | |
release: | |
needs: [ build, build-linux-arm64, check ] | |
if: ${{ github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.check.outputs.commit_hash }} | |
- run: echo "FAVA_VERSION=$(cat FAVA_VERSION)" >> ${{ github.env }} | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Zip artifacts | |
working-directory: artifacts | |
run: | | |
for d in */; do | |
(cd "$d" && zip -r "../$d.zip" .) | |
done | |
- run: find artifacts | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "artifacts/**/*.zip" | |
tag: "fava-${{ env.FAVA_VERSION }}-${{ github.run_id }}" | |
body: "Source: https://pypi.org/project/fava/${{ env.FAVA_VERSION }}/" | |
token: ${{ secrets.GITHUB_TOKEN }} |