Skip to content

Commit

Permalink
added osx config to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
gokulprathin8 committed Nov 13, 2023
1 parent a29f01e commit 4b1fac6
Showing 1 changed file with 59 additions and 18 deletions.
77 changes: 59 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_dispatch:

jobs:
build:
build-jar:
runs-on: ubuntu-latest

steps:
Expand All @@ -36,22 +36,19 @@ jobs:
- name: Append version to DEBIAN/control
run: |
echo "Version: ${{ env.VERSION }}" >> $GITHUB_WORKSPACE/linux-deployment/DEBIAN/control
- name: Set execute permissions for postinst script
run: chmod 755 $GITHUB_WORKSPACE/linux-deployment/DEBIAN/postinst

- name: Copy geoweaver.jar to linux-deployment directory
run: |
ls $GITHUB_WORKSPACE/target/
cp $GITHUB_WORKSPACE/target/geoweaver.jar $GITHUB_WORKSPACE/linux-deployment/usr/local/bin/
run: cp $GITHUB_WORKSPACE/target/geoweaver.jar $GITHUB_WORKSPACE/linux-deployment/usr/local/bin/

- name: Make geoweaver.sh executable
run: chmod +x $GITHUB_WORKSPACE/linux-deployment/usr/local/bin/geoweaver.sh

- name: Build deb package
run: |
cd $GITHUB_WORKSPACE/linux-deployment
cat DEBIAN/control
dpkg-deb --build . geoweaver.deb
- name: Upload Geoweaver Artifacts
Expand All @@ -63,8 +60,46 @@ jobs:
pom.xml
linux-deployment/*.deb
build-macos:
needs: build-jar
runs-on: macos-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Download Geoweaver Artifacts
uses: actions/download-artifact@v2
with:
name: geoweaver-artifacts

- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'

- name: Build .app file
run: |
chmod +x ${GITHUB_WORKSPACE}/macos-deployment/make-app.sh
${GITHUB_WORKSPACE}/macos-deployment/make-app.sh
- name: Create .dmg file with Applications shortcut
run: |
APP_NAME="Geoweaver"
DMG_TEMP_DIR="${GITHUB_WORKSPACE}/dmg_temp"
mkdir -p "${DMG_TEMP_DIR}"
cp -r "${GITHUB_WORKSPACE}/geoweaver.app" "${DMG_TEMP_DIR}"
ln -s /Applications "${DMG_TEMP_DIR}/Applications"
hdiutil create -volname "$APP_NAME" -srcfolder "${DMG_TEMP_DIR}" -ov -format UDZO "${GITHUB_WORKSPACE}/${APP_NAME}.dmg"
- name: Upload .dmg file as an artifact
uses: actions/upload-artifact@v2
with:
name: geoweaver-dmg
path: /Users/runner/work/Geoweaver/Geoweaver/Geoweaver.dmg

release:
needs: build
needs: [build-jar, build-macos]
runs-on: ubuntu-latest

steps:
Expand All @@ -79,22 +114,18 @@ jobs:
with:
name: geoweaver-artifacts

- name: Download .dmg file
uses: actions/download-artifact@v2
with:
name: geoweaver-dmg

- name: Get ID and upload URL of the latest release
run: |
RESPONSE=$(curl -s -H "Authorization: token ${{ secrets.PAT }}" "https://api.github.com/repos/${{ github.repository }}/releases/latest")
UPLOAD_URL=$(echo "$RESPONSE" | jq -r .upload_url)
RELEASE_ID=$(echo "$RESPONSE" | jq -r .id)
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV
echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV
# Use the 'find' command to list all subfolders within the specified folder
folder_path=$GITHUB_WORKSPACE
# The '-type d' flag ensures that only directories are selected
subfolders=$(find "$folder_path" -type d)
# Loop through the subfolders and print their names
for subfolder in $subfolders; do
echo "$subfolder"
done
- name: Set release title to version
run: |
Expand All @@ -108,7 +139,7 @@ jobs:
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: /home/runner/work/geoweaver-deployment-test/geoweaver-deployment-test/target/geoweaver.jar
asset_path: /home/runner/work/Geoweaver/Geoweaver/target/geoweaver.jar
asset_name: geoweaver.jar
asset_content_type: application/java-archive
env:
Expand All @@ -118,8 +149,18 @@ jobs:
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: /home/runner/work/geoweaver-deployment-test/geoweaver-deployment-test/linux-deployment/geoweaver.deb
asset_path: /home/runner/work/Geoweaver/Geoweaver/linux-deployment/geoweaver.deb
asset_name: geoweaver.deb
asset_content_type: application/vnd.debian.binary-package
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

- name: Upload .dmg file to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: Geoweaver.dmg
asset_name: Geoweaver.dmg
asset_content_type: application/x-diskcopy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 4b1fac6

Please sign in to comment.