Skip to content

Build

Build #642

Workflow file for this run

on:
push:
branches: [master]
pull_request:
schedule:
- cron: '0 9 * * *'
# Progressive cache requires sequential builds
concurrency: build
name: Build
jobs:
flatpak:
name: Flatpak build
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:kde-5.15-22.08
options: --privileged -v /:/rootfs
steps:
- name: Maximize build space
run: rm -rf /rootfs/usr/share/dotnet /rootfs/usr/local/lib/android /rootfs/opt/hostedtoolcache /rootfs/usr/local/.ghcup && df -h
- name: Check out sources
uses: actions/checkout@v3
with:
submodules: true
- name: Flatpak cache
uses: twelho/cache@conditional
with:
path: .cache
key: flatpak-builder-${{ matrix.branch }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: flatpak-builder
- name: Unified cache setup
run: mkdir -p ".cache/${{ matrix.branch }}" && ln -s ".cache/${{ matrix.branch }}" .flatpak-builder
- name: Template the manifest
uses: jayamanikharyono/jinja-action@master
with:
data: branch=${{ matrix.branch }}
path: org.freecadweb.FreeCAD.yaml
- name: Install repo SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.DEPLOY_KEY }}
name: deploy_key
config: |
Host github.com
IdentitiesOnly yes
IdentityFile ~/.ssh/deploy_key
known_hosts: github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
- name: Check out repo
run: git clone git@github.com:twelho/freecad-realthunder.git repo
- name: Import GPG signing key
id: signing_key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.SIGNING_KEY }}
passphrase: ${{ secrets.SIGNING_KEY_PASSPHRASE }}
- name: Capture the start timestamp
run: |
echo "$(date +%s)" > .gh-start-timestamp
- name: Build the application
timeout-minutes: 330 # Time out early to save the cache in time
uses: twelho/flatpak-github-actions/flatpak-builder@local-repo-path
with:
manifest-path: org.freecadweb.FreeCAD.yaml
bundle: org.freecadweb.FreeCAD-${{ matrix.branch }}.flatpak
local-repository: repo/repo
gpg-sign: ${{ steps.signing_key.outputs.keyid }}
cache: false
branch: ${{ matrix.branch }}
- name: Determine if the cache should be updated
run: |
if (( "$(date +%s)" - "$(cat .gh-start-timestamp)" >= 330 * 60 )); then
echo "Build step ran until timeout, cache should be updated"
touch .gh-save-cache
fi
if: failure()
- name: Prune and update the repo
run: |
ostree --repo=repo/repo prune --depth 0 --keep-younger-than 0
flatpak build-update-repo --gpg-sign "${{ steps.signing_key.outputs.keyid }}" repo/repo
- name: Push a new repo commit
run: |
cd repo
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit --amend -m "Update ${{ matrix.branch }} build"
git push -f
strategy:
max-parallel: 1 # Repository operations must be serial
fail-fast: false # Don't fail the whole workflow if one branch fails
matrix:
branch: [LinkStable, LinkMerge]