From b38b6e6ec373d59553fd68dcac22fc42cd61d882 Mon Sep 17 00:00:00 2001 From: Jagandeep Brar Date: Tue, 19 Apr 2022 01:00:03 -0400 Subject: [PATCH] chore(ci): abstract platform publishing workflows [platform:web] --- .github/actions/prepare_for_build/action.yml | 4 + .github/workflows/build_web.yml | 2 +- .github/workflows/publish.yml | 377 ------------------- .github/workflows/publish_android.yml | 55 +++ .github/workflows/publish_ios.yml | 53 +++ .github/workflows/publish_linux.yml | 35 ++ .github/workflows/publish_macos.yml | 53 +++ .github/workflows/publish_s3.yml | 205 ++++++++++ .github/workflows/publish_web.yml | 83 ++++ .github/workflows/release.yml | 74 +++- 10 files changed, 551 insertions(+), 390 deletions(-) delete mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/publish_android.yml create mode 100644 .github/workflows/publish_ios.yml create mode 100644 .github/workflows/publish_linux.yml create mode 100644 .github/workflows/publish_macos.yml create mode 100644 .github/workflows/publish_s3.yml create mode 100644 .github/workflows/publish_web.yml diff --git a/.github/actions/prepare_for_build/action.yml b/.github/actions/prepare_for_build/action.yml index 941a2d4c..8bc55a2f 100644 --- a/.github/actions/prepare_for_build/action.yml +++ b/.github/actions/prepare_for_build/action.yml @@ -92,6 +92,10 @@ runs: with: xcode-version: latest-stable + - name: Setup Docker + if: ${{ inputs.platform == 'web' }} + uses: docker/setup-buildx-action@v1 + - name: Setup Match SSH Keys if: ${{ inputs.platform == 'ios' || inputs.platform == 'macos' }} uses: webfactory/ssh-agent@v0.5.4 diff --git a/.github/workflows/build_web.yml b/.github/workflows/build_web.yml index bbc6a1af..196b35e3 100644 --- a/.github/workflows/build_web.yml +++ b/.github/workflows/build_web.yml @@ -51,7 +51,7 @@ jobs: with: type: zip filename: output/lunasea-web-canvaskit.zip - directory: ${{ github.workspace }}/build/web + path: build/web - name: Upload Artifact uses: actions/upload-artifact@v3 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 2c2bbdb7..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,377 +0,0 @@ -name: 'Publish Releases' - -on: - workflow_call: - inputs: - build-title: - required: true - type: string - flavor: - required: true - type: string - enable-android: - required: true - type: string - enable-ios: - required: true - type: string - enable-linux: - required: true - type: string - enable-macos: - required: true - type: string - enable-web: - required: true - type: string - enable-windows: - required: true - type: string - - secrets: - APPLE_ID: - required: true - APPLE_ITC_TEAM_ID: - required: true - APPLE_STORE_CONNECT_ISSUER_ID: - required: true - APPLE_STORE_CONNECT_KEY: - required: true - APPLE_STORE_CONNECT_KEY_ID: - required: true - APPLE_TEAM_ID: - required: true - DISCORD_WEBHOOK_EDGE: - required: true - DISCORD_WEBHOOK_BETA: - required: true - DISCORD_WEBHOOK_CANDIDATE: - required: true - DISCORD_WEBHOOK_STABLE: - required: true - GOOGLE_PLAY_API: - required: true - NETLIFY_AUTH_TOKEN: - required: true - SNAPCRAFT_TOKEN: - required: true - S3_ACCESS_KEY: - required: true - S3_BUCKET: - required: true - S3_ENDPOINT: - required: true - S3_KEY_ID: - required: true - S3_REGION: - required: true - -jobs: - android-play-store: - name: Play Store - if: ${{ inputs.enable-android == 'true' }} - runs-on: ubuntu-latest - steps: - - name: Setup Environment - uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master - with: - channel: play-store - google-play-key: ${{ secrets.GOOGLE_PLAY_API }} - - - name: Download Play Store Package - uses: actions/download-artifact@v3 - with: - name: android-playstore-package - path: ${{ github.workspace }}/output - - - name: Determine Release Channel - id: channel - uses: actions/github-script@v6 - env: - FLAVOR: ${{ inputs.flavor }} - with: - result-encoding: string - script: | - const ref = process.env.FLAVOR || 'edge'; - switch (ref) { - case 'beta': return 'alpha'; - case 'candidate': return 'beta'; - case 'stable': return 'production'; - case 'edge': - default: return 'internal'; - } - - - name: Deploy to Google Play Store - working-directory: ${{ github.workspace }}/android - env: - SUPPLY_JSON_KEY: ${{ github.workspace }}/keys/googleplay.json - run: bundle exec fastlane deploy_playstore track:${{ steps.channel.outputs.result }} aab:${{ github.workspace }}/output/lunasea-android.aab version_name:${{ inputs.build-title }} - - ios-app-store: - name: App Store (iOS) - if: ${{ inputs.enable-ios == 'true' }} - runs-on: macos-latest - steps: - - name: Setup Environment - uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master - with: - channel: app-store - appstore-connect-key: ${{ secrets.APPLE_STORE_CONNECT_KEY }} - - - name: Download App Store Package - uses: actions/download-artifact@v3 - with: - name: ios-appstore-package - path: ${{ github.workspace }}/output - - - name: Deploy to App Store Connect - working-directory: ${{ github.workspace }}/ios - env: - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} - APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} - APPLE_STORE_CONNECT_KEY_FILEPATH: ${{ github.workspace }}/keys/appstore.p8 - APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - run: bundle exec fastlane deploy_appstore groups:${{ inputs.flavor }} ipa:${{ github.workspace }}/output/lunasea-ios.ipa - - linux-snapcraft: - name: Snapcraft - if: ${{ inputs.enable-linux == 'true' }} - runs-on: ubuntu-latest - steps: - - name: Setup Environment - uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master - with: - channel: snapcraft - snapcraft-token: ${{ secrets.SNAPCRAFT_TOKEN }} - - - name: Download Snap - uses: actions/download-artifact@v3 - with: - name: linux-snapcraft - path: ${{ github.workspace }}/output - - - name: Deploy to Snapcraft - run: snapcraft upload --release=${{ inputs.flavor }} ${{ github.workspace }}/output/lunasea-linux-amd64.snap - - macos-appstore: - name: App Store (macOS) - if: ${{ inputs.enable-macos == 'true' }} - runs-on: macos-latest - steps: - - name: Setup Environment - uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master - with: - channel: app-store - appstore-connect-key: ${{ secrets.APPLE_STORE_CONNECT_KEY }} - - - name: Download App Store Package - uses: actions/download-artifact@v3 - with: - name: macos-appstore-package - path: ${{ github.workspace }}/output - - - name: Deploy to App Store Connect - working-directory: ${{ github.workspace }}/macos - env: - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} - APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} - APPLE_STORE_CONNECT_KEY_FILEPATH: ${{ github.workspace }}/keys/appstore.p8 - APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - run: bundle exec fastlane deploy_appstore groups:${{ inputs.flavor }} pkg:${{ github.workspace }}/output/lunasea-macos-amd64.pkg - - web-docker: - name: Docker - if: ${{ inputs.enable-web == 'true' }} - runs-on: ubuntu-latest - steps: - - name: Setup Environment - uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master - with: - channel: docker - ghcr-actor: ${{ github.actor }} - ghcr-token: ${{ github.token }} - - - name: Download Docker Image - uses: actions/download-artifact@v3 - with: - name: web-docker - path: ${{ github.workspace }}/output - - - name: Load Docker Image - run: | - docker load --input ${{ github.workspace}}/output/lunasea-web-docker.tar - docker image ls -a - - - name: Deploy to GitHub Container Registry - run: docker image push --all-tags ghcr.io/jagandeepbrar/lunasea - - web-netlify: - name: Netlify - if: ${{ inputs.enable-web == 'true' }} - runs-on: ubuntu-latest - steps: - - name: Setup Environment - uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master - with: - channel: netlify - - - name: Download Web Package - uses: actions/download-artifact@v3 - with: - name: web-hosted - path: ${{ github.workspace }}/output - - - name: Determine Release Channel - id: channel - uses: actions/github-script@v6 - env: - FLAVOR: ${{ inputs.flavor }} - with: - result-encoding: string - script: | - const ref = process.env.FLAVOR || 'edge'; - switch (ref) { - case 'beta': return '11ef2676-fc31-41b5-897b-fd21273d87ed'; - case 'candidate': return '4636e6a1-17ef-45a2-a2b6-3d1c166fd1df'; - case 'stable': return '6634f0b1-323c-4a2f-bd0b-8f1f388673a9'; - case 'edge': - default: return '325e197e-55f4-449a-b2bb-6831fe47bf2a'; - } - - - name: Deploy to Netlify - uses: nwtgck/actions-netlify@v1.2 - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NETLIFY_SITE_ID: ${{ steps.channel.outputs.result }} - with: - publish-dir: ${{ github.workspace}}/output - production-deploy: true - deploy-message: ${{ inputs.build-title }} - - s3: - name: S3 - if: ${{ inputs.enable-android == 'true' || inputs.enable-ios == 'true' || inputs.enable-linux == 'true' || inputs.enable-macos == 'true' || inputs.enable-windows == 'true' }} - runs-on: ubuntu-latest - steps: - - name: Setup Environment - uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master - with: - channel: s3 - - - name: Download Android App Package - if: ${{ inputs.enable-android == 'true' }} - uses: actions/download-artifact@v3 - with: - name: android-app-package - path: ${{ github.workspace }}/output - - - name: Download iOS App Package - if: ${{ inputs.enable-ios == 'true' }} - uses: actions/download-artifact@v3 - with: - name: ios-appstore-package - path: ${{ github.workspace }}/output - - - name: Download Linux Snap - if: ${{ inputs.enable-linux == 'true' }} - uses: actions/download-artifact@v3 - with: - name: linux-snapcraft - path: ${{ github.workspace }}/output - - - name: Download macOS App Package - if: ${{ inputs.enable-macos == 'true' }} - uses: actions/download-artifact@v3 - with: - name: macos-app-package - path: ${{ github.workspace }}/output - - - name: Download macOS Disk Image - if: ${{ inputs.enable-macos == 'true' }} - uses: actions/download-artifact@v3 - with: - name: macos-disk-image - path: ${{ github.workspace }}/output - - - name: Download Windows App Package - if: ${{ inputs.enable-windows == 'true' }} - uses: actions/download-artifact@v3 - with: - name: windows-app-package - path: ${{ github.workspace }}/output - - - name: Download Web Archive - if: ${{ inputs.enable-web == 'true' }} - uses: actions/download-artifact@v3 - with: - name: web-archive - path: ${{ github.workspace }}/output - - - name: Download Windows MSIX Installer - if: ${{ inputs.enable-windows == 'true' }} - uses: actions/download-artifact@v3 - with: - name: windows-msix-installer - path: ${{ github.workspace }}/output - - - name: Upload to S3 Bucket (Build Title) - uses: jakejarvis/s3-sync-action@v0.5.1 - with: - args: --acl public-read --follow-symlinks - env: - AWS_ACCESS_KEY_ID: ${{ secrets.S3_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} - AWS_S3_BUCKET: ${{ secrets.S3_BUCKET }} - AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }} - AWS_REGION: ${{ secrets.S3_REGION }} - SOURCE_DIR: ${{ github.workspace }}/output - DEST_DIR: ${{ inputs.build-title }} - - - name: Upload to S3 Bucket (Latest) - uses: jakejarvis/s3-sync-action@v0.5.1 - with: - args: --acl public-read --follow-symlinks - env: - AWS_ACCESS_KEY_ID: ${{ secrets.S3_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} - AWS_S3_BUCKET: ${{ secrets.S3_BUCKET }} - AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }} - AWS_REGION: ${{ secrets.S3_REGION }} - SOURCE_DIR: ${{ github.workspace }}/output - DEST_DIR: latest/${{ inputs.flavor }} - - - name: Determine Webhook Channel - id: webhook - uses: actions/github-script@v6 - env: - DISCORD_WEBHOOK_EDGE: ${{ secrets.DISCORD_WEBHOOK_EDGE }} - DISCORD_WEBHOOK_BETA: ${{ secrets.DISCORD_WEBHOOK_BETA }} - DISCORD_WEBHOOK_CANDIDATE: ${{ secrets.DISCORD_WEBHOOK_CANDIDATE }} - DISCORD_WEBHOOK_STABLE: ${{ secrets.DISCORD_WEBHOOK_STABLE }} - FLAVOR: ${{ inputs.flavor }} - with: - result-encoding: string - script: | - const ref = process.env.FLAVOR || 'edge'; - switch (ref) { - case 'beta': return process.env.DISCORD_WEBHOOK_BETA; - case 'candidate': return process.env.DISCORD_WEBHOOK_CANDIDATE; - case 'stable': return process.env.DISCORD_WEBHOOK_STABLE; - case 'edge': - default: return process.env.DISCORD_WEBHOOK_EDGE; - } - - - name: Send Discord Message - uses: sarisia/actions-status-discord@v1 - with: - webhook: ${{ steps.webhook.outputs.result }} - username: LunaSea Support - avatar_url: https://raw.githubusercontent.com/JagandeepBrar/LunaSea/master/assets/icon/icon.png - noprefix: true - color: 0x4ECCA3 - title: ${{ inputs.build-title }} - description: '[Download](https://builds.lunasea.app/#${{ inputs.build-title }}/)' diff --git a/.github/workflows/publish_android.yml b/.github/workflows/publish_android.yml new file mode 100644 index 00000000..2aaa12a5 --- /dev/null +++ b/.github/workflows/publish_android.yml @@ -0,0 +1,55 @@ +name: Publish Android + +on: + workflow_call: + inputs: + build-title: + required: true + type: string + flavor: + required: true + type: string + + secrets: + GOOGLE_PLAY_API: + required: true + +jobs: + play-store: + name: Play Store + runs-on: ubuntu-latest + steps: + - name: Setup Environment + uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master + with: + channel: play-store + google-play-key: ${{ secrets.GOOGLE_PLAY_API }} + + - name: Download Play Store Package + uses: actions/download-artifact@v3 + with: + name: android-playstore-package + path: ${{ github.workspace }}/output + + - name: Determine Release Channel + id: channel + uses: actions/github-script@v6 + env: + FLAVOR: ${{ inputs.flavor }} + with: + result-encoding: string + script: | + const ref = process.env.FLAVOR || 'edge'; + switch (ref) { + case 'beta': return 'alpha'; + case 'candidate': return 'beta'; + case 'stable': return 'production'; + case 'edge': + default: return 'internal'; + } + + - name: Deploy to Google Play Store + working-directory: ${{ github.workspace }}/android + env: + SUPPLY_JSON_KEY: ${{ github.workspace }}/keys/googleplay.json + run: bundle exec fastlane deploy_playstore track:${{ steps.channel.outputs.result }} aab:${{ github.workspace }}/output/lunasea-android.aab version_name:${{ inputs.build-title }} diff --git a/.github/workflows/publish_ios.yml b/.github/workflows/publish_ios.yml new file mode 100644 index 00000000..748f3066 --- /dev/null +++ b/.github/workflows/publish_ios.yml @@ -0,0 +1,53 @@ +name: Publish iOS + +on: + workflow_call: + inputs: + build-title: + required: true + type: string + flavor: + required: true + type: string + + secrets: + APPLE_ID: + required: true + APPLE_ITC_TEAM_ID: + required: true + APPLE_STORE_CONNECT_ISSUER_ID: + required: true + APPLE_STORE_CONNECT_KEY: + required: true + APPLE_STORE_CONNECT_KEY_ID: + required: true + APPLE_TEAM_ID: + required: true + +jobs: + app-store: + name: App Store (iOS) + runs-on: macos-latest + steps: + - name: Setup Environment + uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master + with: + channel: app-store + appstore-connect-key: ${{ secrets.APPLE_STORE_CONNECT_KEY }} + + - name: Download App Store Package + uses: actions/download-artifact@v3 + with: + name: ios-appstore-package + path: ${{ github.workspace }}/output + + - name: Deploy to App Store Connect + working-directory: ${{ github.workspace }}/ios + env: + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} + APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} + APPLE_STORE_CONNECT_KEY_FILEPATH: ${{ github.workspace }}/keys/appstore.p8 + APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + run: bundle exec fastlane deploy_appstore groups:${{ inputs.flavor }} ipa:${{ github.workspace }}/output/lunasea-ios.ipa diff --git a/.github/workflows/publish_linux.yml b/.github/workflows/publish_linux.yml new file mode 100644 index 00000000..b751b62f --- /dev/null +++ b/.github/workflows/publish_linux.yml @@ -0,0 +1,35 @@ +name: Publish Linux + +on: + workflow_call: + inputs: + build-title: + required: true + type: string + flavor: + required: true + type: string + + secrets: + SNAPCRAFT_TOKEN: + required: true + +jobs: + snapcraft: + name: Snapcraft + runs-on: ubuntu-latest + steps: + - name: Setup Environment + uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master + with: + channel: snapcraft + snapcraft-token: ${{ secrets.SNAPCRAFT_TOKEN }} + + - name: Download Snap + uses: actions/download-artifact@v3 + with: + name: linux-snapcraft + path: ${{ github.workspace }}/output + + - name: Deploy to Snapcraft + run: snapcraft upload --release=${{ inputs.flavor }} ${{ github.workspace }}/output/lunasea-linux-amd64.snap diff --git a/.github/workflows/publish_macos.yml b/.github/workflows/publish_macos.yml new file mode 100644 index 00000000..fa703d56 --- /dev/null +++ b/.github/workflows/publish_macos.yml @@ -0,0 +1,53 @@ +name: Publish macOS + +on: + workflow_call: + inputs: + build-title: + required: true + type: string + flavor: + required: true + type: string + + secrets: + APPLE_ID: + required: true + APPLE_ITC_TEAM_ID: + required: true + APPLE_STORE_CONNECT_ISSUER_ID: + required: true + APPLE_STORE_CONNECT_KEY: + required: true + APPLE_STORE_CONNECT_KEY_ID: + required: true + APPLE_TEAM_ID: + required: true + +jobs: + app-store: + name: App Store (macOS) + runs-on: macos-latest + steps: + - name: Setup Environment + uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master + with: + channel: app-store + appstore-connect-key: ${{ secrets.APPLE_STORE_CONNECT_KEY }} + + - name: Download App Store Package + uses: actions/download-artifact@v3 + with: + name: macos-appstore-package + path: ${{ github.workspace }}/output + + - name: Deploy to App Store Connect + working-directory: ${{ github.workspace }}/macos + env: + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} + APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} + APPLE_STORE_CONNECT_KEY_FILEPATH: ${{ github.workspace }}/keys/appstore.p8 + APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + run: bundle exec fastlane deploy_appstore groups:${{ inputs.flavor }} pkg:${{ github.workspace }}/output/lunasea-macos-amd64.pkg diff --git a/.github/workflows/publish_s3.yml b/.github/workflows/publish_s3.yml new file mode 100644 index 00000000..ba981f37 --- /dev/null +++ b/.github/workflows/publish_s3.yml @@ -0,0 +1,205 @@ +name: Publish S3 + +on: + workflow_call: + inputs: + build-title: + required: true + type: string + flavor: + required: true + type: string + enable-android: + required: true + type: string + enable-ios: + required: true + type: string + enable-linux: + required: true + type: string + enable-macos: + required: true + type: string + enable-web: + required: true + type: string + enable-windows: + required: true + type: string + + secrets: + DISCORD_WEBHOOK_EDGE: + required: true + DISCORD_WEBHOOK_BETA: + required: true + DISCORD_WEBHOOK_CANDIDATE: + required: true + DISCORD_WEBHOOK_STABLE: + required: true + S3_ACCESS_KEY: + required: true + S3_BUCKET: + required: true + S3_ENDPOINT: + required: true + S3_KEY_ID: + required: true + S3_REGION: + required: true + +jobs: + s3: + name: S3 + runs-on: ubuntu-latest + steps: + - name: Setup Environment + uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master + with: + channel: s3 + + - name: Download Android App Package + uses: actions/download-artifact@v3 + with: + name: android-app-package + path: ${{ github.workspace }}/output + if-no-files-found: warn + + - name: Download iOS App Package + uses: actions/download-artifact@v3 + with: + name: ios-appstore-package + path: ${{ github.workspace }}/output + if-no-files-found: warn + + - name: Download Linux Snap + uses: actions/download-artifact@v3 + with: + name: linux-snapcraft + path: ${{ github.workspace }}/output + if-no-files-found: warn + + - name: Download macOS App Package + uses: actions/download-artifact@v3 + with: + name: macos-app-package + path: ${{ github.workspace }}/output + if-no-files-found: warn + + - name: Download macOS Disk Image + uses: actions/download-artifact@v3 + with: + name: macos-disk-image + path: ${{ github.workspace }}/output + if-no-files-found: warn + + - name: Download Windows App Package + uses: actions/download-artifact@v3 + with: + name: windows-app-package + path: ${{ github.workspace }}/output + if-no-files-found: warn + + - name: Download Web Archive + uses: actions/download-artifact@v3 + with: + name: web-archive + path: ${{ github.workspace }}/output + if-no-files-found: warn + + - name: Download Windows MSIX Installer + uses: actions/download-artifact@v3 + with: + name: windows-msix-installer + path: ${{ github.workspace }}/output + if-no-files-found: warn + + - name: Upload to S3 Bucket (Build Title) + uses: jakejarvis/s3-sync-action@v0.5.1 + with: + args: --acl public-read --follow-symlinks + env: + AWS_ACCESS_KEY_ID: ${{ secrets.S3_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} + AWS_S3_BUCKET: ${{ secrets.S3_BUCKET }} + AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }} + AWS_REGION: ${{ secrets.S3_REGION }} + SOURCE_DIR: ${{ github.workspace }}/output + DEST_DIR: ${{ inputs.build-title }} + + - name: Upload to S3 Bucket (Latest) + uses: jakejarvis/s3-sync-action@v0.5.1 + with: + args: --acl public-read --follow-symlinks + env: + AWS_ACCESS_KEY_ID: ${{ secrets.S3_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} + AWS_S3_BUCKET: ${{ secrets.S3_BUCKET }} + AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }} + AWS_REGION: ${{ secrets.S3_REGION }} + SOURCE_DIR: ${{ github.workspace }}/output + DEST_DIR: latest/${{ inputs.flavor }} + + - name: Determine Webhook Channel + id: webhook + uses: actions/github-script@v6 + env: + DISCORD_WEBHOOK_EDGE: ${{ secrets.DISCORD_WEBHOOK_EDGE }} + DISCORD_WEBHOOK_BETA: ${{ secrets.DISCORD_WEBHOOK_BETA }} + DISCORD_WEBHOOK_CANDIDATE: ${{ secrets.DISCORD_WEBHOOK_CANDIDATE }} + DISCORD_WEBHOOK_STABLE: ${{ secrets.DISCORD_WEBHOOK_STABLE }} + FLAVOR: ${{ inputs.flavor }} + with: + result-encoding: string + script: | + const ref = process.env.FLAVOR || 'edge'; + switch (ref) { + case 'beta': return process.env.DISCORD_WEBHOOK_BETA; + case 'candidate': return process.env.DISCORD_WEBHOOK_CANDIDATE; + case 'stable': return process.env.DISCORD_WEBHOOK_STABLE; + case 'edge': + default: return process.env.DISCORD_WEBHOOK_EDGE; + } + + - name: Create Discord Message + id: message + uses: actions/github-script@v6 + env: + BUILD_TITLE: ${{ inputs.build-title }} + ANDROID: ${{ inputs.enable-android }} + IOS: ${{ inputs.enable-ios }} + LINUX: ${{ inputs.enable-linux }} + MACOS: ${{ inputs.enable-macos }} + WEB: ${{ inputs.enable-web }} + WINDOWS: ${{ inputs.enable-windows }} + with: + result-encoding: string + script: | + const { ANDROID, IOS, LINUX, MACOS, WEB, WINDOWS } = process.env; + const url = `https://builds.lunasea.app/#${ process.env.BUILD_TITLE }`; + let _base = `[Download]${url}`; + if ( ANDROID || IOS || LINUX || MACOS || WEB || WINDOWS) { + _base += '\n\nThis release is only available for the following platforms: '; + + const platforms = []; + if (ANDROID) platforms.push('Android'); + if (IOS) platforms.push('iOS'); + if (LINUX) platforms.push('Linux'); + if (MACOS) platforms.push('macOS'); + if (WEB) platforms.push('Web'); + if (WINDOWS) platforms.push('Windows'); + + _base += platforms.map((p) => `**${p}**`).join(', '); + } + return _base; + + - name: Send Discord Message + uses: sarisia/actions-status-discord@v1 + with: + webhook: ${{ steps.webhook.outputs.result }} + username: LunaSea Support + avatar_url: https://raw.githubusercontent.com/JagandeepBrar/LunaSea/master/assets/icon/icon.png + noprefix: true + color: 0x4ECCA3 + title: ${{ inputs.build-title }} + description: ${{ steps.message.outputs.result }} diff --git a/.github/workflows/publish_web.yml b/.github/workflows/publish_web.yml new file mode 100644 index 00000000..98e21756 --- /dev/null +++ b/.github/workflows/publish_web.yml @@ -0,0 +1,83 @@ +name: Publish Web (Docker) + +on: + workflow_call: + inputs: + build-title: + required: true + type: string + flavor: + required: true + type: string + + secrets: + NETLIFY_AUTH_TOKEN: + required: true + +jobs: + docker: + name: Docker + runs-on: ubuntu-latest + steps: + - name: Setup Environment + uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master + with: + channel: docker + ghcr-actor: ${{ github.actor }} + ghcr-token: ${{ github.token }} + + - name: Download Docker Image + uses: actions/download-artifact@v3 + with: + name: web-docker + path: ${{ github.workspace }}/output + + - name: Load Docker Image + run: | + docker load --input ${{ github.workspace}}/output/lunasea-web-docker.tar + docker image ls -a + + - name: Deploy to GitHub Container Registry + run: docker image push --all-tags ghcr.io/jagandeepbrar/lunasea + + netlify: + name: Netlify + runs-on: ubuntu-latest + steps: + - name: Setup Environment + uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master + with: + channel: netlify + + - name: Download Web Package + uses: actions/download-artifact@v3 + with: + name: web-hosted + path: ${{ github.workspace }}/output + + - name: Determine Release Channel + id: channel + uses: actions/github-script@v6 + env: + FLAVOR: ${{ inputs.flavor }} + with: + result-encoding: string + script: | + const ref = process.env.FLAVOR || 'edge'; + switch (ref) { + case 'beta': return '11ef2676-fc31-41b5-897b-fd21273d87ed'; + case 'candidate': return '4636e6a1-17ef-45a2-a2b6-3d1c166fd1df'; + case 'stable': return '6634f0b1-323c-4a2f-bd0b-8f1f388673a9'; + case 'edge': + default: return '325e197e-55f4-449a-b2bb-6831fe47bf2a'; + } + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v1.2 + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ steps.channel.outputs.result }} + with: + publish-dir: ${{ github.workspace}}/output + production-deploy: true + deploy-message: ${{ inputs.build-title }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7234a4fc..1f8fdb69 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -114,11 +114,71 @@ jobs: CODE_SIGNING_PUBLISHER: ${{ secrets.CODE_SIGNING_PUBLISHER }} CODE_SIGNING_PUBLISHER_NAME: ${{ secrets.CODE_SIGNING_PUBLISHER_NAME }} - publish: + publish_android: + name: Publish Android + needs: [ prepare, build-android ] + uses: JagandeepBrar/LunaSea/.github/workflows/publish_android.yml@master + with: + flavor: ${{ github.event.inputs.flavor || 'edge' }} + build-title: ${{ needs.prepare.outputs.build-title }} + secrets: + GOOGLE_PLAY_API: ${{ secrets.GOOGLE_PLAY_API }} + + publish_ios: + name: Publish iOS + needs: [ prepare, build-ios ] + uses: JagandeepBrar/LunaSea/.github/workflows/publish_ios.yml@master + with: + flavor: ${{ github.event.inputs.flavor || 'edge' }} + build-title: ${{ needs.prepare.outputs.build-title }} + secrets: + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} + APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} + APPLE_STORE_CONNECT_KEY: ${{ secrets.APPLE_STORE_CONNECT_KEY }} + APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + + publish_linux: + name: Publish Linux + needs: [ prepare, build-linux ] + uses: JagandeepBrar/LunaSea/.github/workflows/publish_linux.yml@master + with: + flavor: ${{ github.event.inputs.flavor || 'edge' }} + build-title: ${{ needs.prepare.outputs.build-title }} + secrets: + SNAPCRAFT_TOKEN: ${{ secrets.SNAPCRAFT_TOKEN }} + + publish_macos: + name: Publish macOS + needs: [ prepare, build-macos ] + uses: JagandeepBrar/LunaSea/.github/workflows/publish_macos.yml@master + with: + flavor: ${{ github.event.inputs.flavor || 'edge' }} + build-title: ${{ needs.prepare.outputs.build-title }} + secrets: + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} + APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} + APPLE_STORE_CONNECT_KEY: ${{ secrets.APPLE_STORE_CONNECT_KEY }} + APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + + publish_web: + name: Publish Web + needs: [ prepare, build-web ] + uses: JagandeepBrar/LunaSea/.github/workflows/publish_web.yml@master + with: + flavor: ${{ github.event.inputs.flavor || 'edge' }} + build-title: ${{ needs.prepare.outputs.build-title }} + secrets: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + + publish_s3: name: Publish needs: [ prepare, build-android, build-ios, build-linux, build-macos, build-web, build-windows ] if: ${{ always() }} - uses: JagandeepBrar/LunaSea/.github/workflows/publish.yml@master + uses: JagandeepBrar/LunaSea/.github/workflows/publish_s3.yml@master with: flavor: ${{ github.event.inputs.flavor || 'edge' }} build-title: ${{ needs.prepare.outputs.build-title }} @@ -128,21 +188,11 @@ jobs: enable-macos: ${{ needs.prepare.outputs.enable-macos }} enable-web: ${{ needs.prepare.outputs.enable-web }} enable-windows: ${{ needs.prepare.outputs.enable-windows }} - secrets: - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} - APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} - APPLE_STORE_CONNECT_KEY: ${{ secrets.APPLE_STORE_CONNECT_KEY }} - APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} DISCORD_WEBHOOK_EDGE: ${{ secrets.DISCORD_WEBHOOK_EDGE }} DISCORD_WEBHOOK_BETA: ${{ secrets.DISCORD_WEBHOOK_BETA }} DISCORD_WEBHOOK_CANDIDATE: ${{ secrets.DISCORD_WEBHOOK_CANDIDATE }} DISCORD_WEBHOOK_STABLE: ${{ secrets.DISCORD_WEBHOOK_STABLE }} - GOOGLE_PLAY_API: ${{ secrets.GOOGLE_PLAY_API }} - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - SNAPCRAFT_TOKEN: ${{ secrets.SNAPCRAFT_TOKEN }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_BUCKET: ${{ secrets.S3_BUCKET }} S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}