Skip to content

Commit

Permalink
Merge pull request #117 from ToxicStoxm/CI-CD-Fixes
Browse files Browse the repository at this point in the history
Ci cd fixes
  • Loading branch information
ToxicStoxm authored Nov 25, 2024
2 parents 48e4ebd + 3fdee1b commit 2336c4a
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 123 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
setup:
name: Environment Setup
runs-on: ubuntu-24.04

steps:
# Step 1: Checkout the code
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure we get the full history if needed

# Step 2: Add custom repository for dependencies
- name: Add Custom Repository
run: |
sudo add-apt-repository 'deb https://ftp.uni-stuttgart.de/ubuntu/ oracular main'
sudo apt-get update
# Step 3: Install required dependencies
- name: Install System Dependencies
run: |
sudo apt-get install -y \
libadwaita-1-dev=1.6.0-1ubuntu2 \
gettext \
desktop-file-utils
setup-tools:
name: Setup Build Tools
runs-on: ubuntu-24.04
needs: setup # Depends on the 'setup' job

steps:
# Step 1: Checkout code again if required
- name: Checkout Code
uses: actions/checkout@v4

# Step 2: Set up Java Development Kit
- name: Set up JDK 23
uses: actions/setup-java@v3
with:
java-version: '23'
distribution: 'temurin'

# Step 3: Set up Python
- name: Set up Python
uses: actions/setup-python@v1

build:
name: Build and Install with Meson
runs-on: ubuntu-24.04
needs: [setup, setup-tools] # Depends on the previous jobs

steps:
# Step 1: Checkout code again if needed
- name: Checkout Code
uses: actions/checkout@v4

# Step 2: Run the Meson Build Action
- name: Install and Build with Meson
uses: BSFishy/[email protected]
with:
action: install
setup-options: --prefix /tmp/install
directory: build
meson-version: 1.6.0
ninja-version: 1.11.1.2
45 changes: 0 additions & 45 deletions .github/workflows/main-onPullRequest.yml

This file was deleted.

78 changes: 0 additions & 78 deletions .github/workflows/main-onPush.yml

This file was deleted.

75 changes: 75 additions & 0 deletions .github/workflows/update-flatpak-sources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Update Flatpak Sources

on:
push:
branches:
- main

jobs:
setup-environment:
name: Setup Environment
runs-on: ubuntu-24.04

steps:
# Step 1: Checkout the code
- name: Checkout Code
uses: actions/checkout@v4

# Step 2: Set up Java Development Kit (JDK)
- name: Set up JDK 23
uses: actions/setup-java@v3
with:
java-version: '23'
distribution: 'temurin'

generate-flatpak-sources:
name: Generate Flatpak Sources
runs-on: ubuntu-24.04
needs: setup-environment # Ensures environment setup is completed

steps:
# Step 1: Checkout the code (again, if necessary)
- name: Checkout Code
uses: actions/checkout@v4

# Step 2: Generate flatpak-sources.json
- name: Generate flatpak-sources.json
run: ./gradlew flatpakGradleGenerator

compare-and-sync:
name: Compare and Update Flatpak Sources
runs-on: ubuntu-24.04
needs: generate-flatpak-sources # Ensures the sources file is generated

steps:
# Step 1: Checkout the code
- name: Checkout Code
uses: actions/checkout@v4

# Step 2: Compare flatpak-sources.json and create PR if needed
- name: Compare and Sync flatpak-sources.json
id: compare
run: |
git fetch origin main
if ! diff -u <(jq . flatpak-sources.json) <(git show origin/main:flatpak-sources.json) >/dev/null; then
git config --global user.email "[email protected]"
git config --global user.name "ToxicStoxm"
# Create a new branch for the update
git checkout -b update-flatpak-sources
# Synchronize repository to prevent conflicts
gh repo sync -b update-flatpak-sources
# Stage and commit changes
git add flatpak-sources.json
git commit -m "Update flatpak-sources.json"
# Push changes to the remote repository
git push --set-upstream origin update-flatpak-sources
# Create a pull request
gh pr create -B main -H update-flatpak-sources --title 'Merge update-flatpak-sources into main' --body 'Created by GitHub Action'
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 2336c4a

Please sign in to comment.