generated from habedi/template-python-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
222 additions
and
272 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_dispatch: # Only enable manual runs for now | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Step 1: Checkout the repository | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Prepare Build Environment | ||
- name: Prepare Environment | ||
run: | | ||
bash build.sh --just-prepare | ||
# Step 3: Set up Snapcraft | ||
- name: Set up Snapcraft | ||
uses: snapcore/action-build@v1 | ||
id: build | ||
with: | ||
snapcraft-channel: stable | ||
|
||
# Step 4: Validate the built Snap | ||
- name: Validate Snap | ||
uses: diddlesnaps/snapcraft-review-action@v1 | ||
with: | ||
snap: ${{ steps.build.outputs.snap }} | ||
isClassic: 'false' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Build and Publish | ||
|
||
on: | ||
workflow_dispatch: # Only enable manual runs for now | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Step 1: Checkout the repository | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Prepare Build Environment | ||
- name: Prepare Environment | ||
run: | | ||
bash build.sh --just-prepare | ||
# Step 3: Set up Snapcraft | ||
- name: Set up Snapcraft | ||
uses: snapcore/action-build@v1 | ||
id: build | ||
with: | ||
snapcraft-channel: stable | ||
continue-on-error: false | ||
|
||
# Step 4: Publish Snap | ||
- name: Publish Snap | ||
uses: snapcore/action-publish@v1 | ||
env: | ||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} | ||
with: | ||
snap: ${{ steps.build.outputs.snap }} | ||
release: stable |
This file was deleted.
Oops, something went wrong.
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
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
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
|
||
# Directory containing versioned Snapcraft files | ||
SNAPCRAFT_FILES_DIR="snapcraft_files" | ||
|
||
# Function to compare semantic versions and find the highest | ||
get_highest_version() { | ||
# Find directories matching the pattern "vX.X.X" and extract valid semantic versions | ||
versions=$(ls -d ${SNAPCRAFT_FILES_DIR}/v* 2>/dev/null | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+' | sort -V) | ||
|
||
# If no valid versions are found, exit with an error | ||
if [[ -z "$versions" ]]; then | ||
echo "Error: No valid semantic version directories found in '$SNAPCRAFT_FILES_DIR'." | ||
exit 1 | ||
fi | ||
|
||
# Return the highest version | ||
echo "$versions" | tail -n 1 | ||
} | ||
|
||
# Get the highest version | ||
FOLDER_NAME=$(get_highest_version) | ||
if [[ $? -ne 0 ]]; then | ||
exit 1 | ||
fi | ||
|
||
# Remove the 'v' prefix to get the version number | ||
VERSION="${FOLDER_NAME#v}" | ||
echo "Detected highest version: $VERSION" | ||
|
||
# Handle the `--just-prepare` argument | ||
if [[ "$1" == "--just-prepare" ]]; then | ||
echo "Preparing Snapcraft files for version $VERSION..." | ||
mkdir -p snap | ||
cp -f "$SNAPCRAFT_FILES_DIR/$FOLDER_NAME/snapcraft.yaml" snap/snapcraft.yaml | ||
echo "Snapcraft.yaml prepared in the 'snap' directory." | ||
exit 0 | ||
fi | ||
|
||
# Build the Snap package for the highest version | ||
echo "Building Snap package for version $VERSION..." | ||
if pushd "$SNAPCRAFT_FILES_DIR/v$VERSION" > /dev/null; then | ||
SNAPCRAFT_BUILD_ENVIRONMENT=multipass snapcraft # Build the package using Multipass | ||
if [[ $? -eq 0 ]]; then | ||
echo "Build successful. Moving Snap package to the root directory..." | ||
mv -f *.snap ../../ # Move the built snap file to the root directory | ||
else | ||
echo "Error: Snap build failed." | ||
exit 1 | ||
fi | ||
popd > /dev/null || exit | ||
else | ||
echo "Error: Failed to access directory '$SNAPCRAFT_FILES_DIR/v$VERSION'." | ||
exit 1 | ||
fi | ||
|
||
echo "Snap package build process completed." |
Empty file.
Empty file.
Empty file.
Oops, something went wrong.