Skip to content

Release v0.3.1 (#257) #254

Release v0.3.1 (#257)

Release v0.3.1 (#257) #254

Workflow file for this run

name: Build Racine components
on:
push:
tags:
- "v*.*.*"
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
version:
name: Determine version
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.version_step.outputs.VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Determine version
id: version_step
run: |
sed s'/v//g' <(echo "VERSION=`make version`") >> "$GITHUB_OUTPUT"
build-app-static:
name: Build app-static
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Build app-static
run: |
make app-deps app-dev-deps
make js-build
- name: Upload app-static
uses: actions/upload-artifact@v4
with:
name: app-static
path: app/static/
build-base:
name: Build base image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# TODO figure out why this step takes so long each time (why are python requirements reinstalled each time?)
# NOTE: it seems to take long to export Docker image actually -> do we really need the docker image to build app static ?
- name: Build docker image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: false
target: racine-base
tags: racine-base:latest
cache-from: type=gha
cache-to: type=gha,mode=max
build-dev:
name: Build dev image
runs-on: ubuntu-latest
needs: [build-base, build-app-static]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download app-static
uses: actions/download-artifact@v4
with:
name: app-static
path: app/static/
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build docker image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: false
target: racine-dev
tags: racine-dev:latest
cache-from: type=gha
cache-to: type=gha,mode=max
build-docker:
name: Build main image
runs-on: ubuntu-latest
needs: [build-base, build-app-static]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download app-static
uses: actions/download-artifact@v4
with:
name: app-static
path: app/static/
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build docker image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: false
target: racine
tags: racine:latest
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=docker,dest=/tmp/racine.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: racine
path: /tmp/racine.tar
run-tests:
name: Run tests in docker
runs-on: ubuntu-latest
needs: build-docker
env:
COMPOSE_FILE: docker/docker-compose.yml
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
run: docker compose run web python -m pytest
push-docker:
if: github.event_name == 'push'
name: Push docker image
runs-on: ubuntu-latest
needs: [build-docker, run-tests, version]
env:
COMPOSE_FILE: docker/docker-compose.yml
steps:
- name: Login to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: racine
path: /tmp
- name: Load Docker image
run: |
docker load --input /tmp/racine.tar
docker image ls -a
- name: Push to ghcr
run: |
docker tag racine:latest \
ghcr.io/hgrf/racine:latest && \
docker push ghcr.io/hgrf/racine:latest && \
echo Successfully pushed ghcr.io/hgrf/racine:latest
- name: Push to ghcr (tagged)
if: startsWith(github.ref, 'refs/tags/')
run: |
sed s'/refs\/tags\///g' <(echo "${{ github.ref }}") | (read TAG; \
docker tag ghcr.io/hgrf/racine:latest \
ghcr.io/hgrf/racine:$TAG && \
docker push ghcr.io/hgrf/racine:$TAG && \
echo Successfully pushed ghcr.io/hgrf/racine:$TAG
)
build-appimage:
name: Build AppImage
runs-on: ubuntu-latest
needs: [version, build-app-static]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install developer dependencies
run: make app-deps app-dev-deps
- name: Download app-static
uses: actions/download-artifact@v4
with:
name: app-static
path: app/static/
- name: Build AppImage
run: make desktop-dist
- uses: actions/upload-artifact@v4
with:
name: "RacineDesktop AppImage ${{ needs.version.outputs.VERSION }}"
path: "desktop/dist/RacineDesktop-${{ needs.version.outputs.VERSION }}.AppImage"
build-macos:
name: Build macOS x64 executable
runs-on: macos-13
needs: [version, build-app-static]
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install developer dependencies
run: make app-deps app-dev-deps
- name: Download app-static
uses: actions/download-artifact@v4
with:
name: app-static
path: app/static/
- name: Build executable
run: make desktop-dist
- uses: actions/upload-artifact@v4
with:
name: "RacineDesktop ${{ needs.version.outputs.VERSION }} macOS x64 dmg"
path: "desktop/dist/RacineDesktop-${{ needs.version.outputs.VERSION }}.dmg"
build-macos-arm64:
name: Build macOS arm64 executable
runs-on: macos-14
needs: [version, build-app-static]
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install developer dependencies
run: make app-deps app-dev-deps
- name: Download app-static
uses: actions/download-artifact@v4
with:
name: app-static
path: app/static/
- name: Build executable
run: make desktop-dist
- uses: actions/upload-artifact@v4
with:
name: "RacineDesktop ${{ needs.version.outputs.VERSION }} macOS arm64 dmg"
path: "desktop/dist/RacineDesktop-${{ needs.version.outputs.VERSION }}-arm64.dmg"
build-windows:
name: Build Windows executable
runs-on: windows-latest
needs: [version, build-app-static]
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install developer dependencies
run: make app-deps app-dev-deps
shell: bash
# c.f. https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
- name: Download app-static
uses: actions/github-script@v7
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.run_id }},
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == 'app-static'
})[0];
if (!matchArtifact) {
throw new Error('Could not find app-static artifact');
}
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/app-static.zip`, Buffer.from(download.data));
- name: Unzip app-static
run: unzip -o app-static.zip -d app/static/
- name: Build executable
run: make desktop-dist
- uses: actions/upload-artifact@v4
with:
name: "RacineDesktop Setup ${{ needs.version.outputs.VERSION }}"
path: "desktop/dist/RacineDesktop Setup ${{ needs.version.outputs.VERSION }}.exe"
release:
name: Publish release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [version, build-appimage, build-macos, build-macos-arm64, build-windows, build-docker, run-tests]
steps:
- name: Download AppImage
uses: actions/download-artifact@v4
with:
name: "RacineDesktop AppImage ${{ needs.version.outputs.VERSION }}"
- name: Download macOS x64 executable
uses: actions/download-artifact@v4
with:
name: "RacineDesktop ${{ needs.version.outputs.VERSION }} macOS x64 dmg"
- name: Download macOS arm64 executable
uses: actions/download-artifact@v4
with:
name: "RacineDesktop ${{ needs.version.outputs.VERSION }} macOS arm64 dmg"
- name: Download Windows executable
uses: actions/download-artifact@v4
with:
name: "RacineDesktop Setup ${{ needs.version.outputs.VERSION }}"
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
RacineDesktop-${{ needs.version.outputs.VERSION }}.AppImage
RacineDesktop-${{ needs.version.outputs.VERSION }}.dmg
RacineDesktop-${{ needs.version.outputs.VERSION }}-arm64.dmg
RacineDesktop Setup ${{ needs.version.outputs.VERSION }}.exe