-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repo: add ability to deploy specific branch for workflow (#1164)
- Loading branch information
1 parent
4d71ab8
commit 850953a
Showing
1 changed file
with
319 additions
and
0 deletions.
There are no files selected for viewing
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,319 @@ | ||
name: Deploy branch on dev | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
# Deploy test & pre sites | ||
deploy-pre: | ||
needs: merge | ||
runs-on: gui | ||
steps: | ||
- name: Checkout git repository | ||
uses: actions/checkout@v3 | ||
- name: Install Node.js, NPM and Yarn | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Prepare | ||
run: | | ||
npm i | ||
npm run minimize:bastyon -- -sha=${{ github.sha }} -run=${{ github.run_number }}${{ github.run_attempt }} | ||
- name: Copy to dest dir | ||
run: rsync -ah --exclude={'.git','.gitignore','.github','package.json','package-lock.json','minimize.json','node_modules','.well-known','assets','proxy16','cordova','res','build'} ./ /docker/pre/ | ||
|
||
deploy-test: | ||
needs: merge | ||
runs-on: gui | ||
steps: | ||
- name: Checkout git repository | ||
uses: actions/checkout@v3 | ||
- name: Install Node.js, NPM and Yarn | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Prepare | ||
run: | | ||
npm i | ||
npm run minimize:bastyon:test -- -sha=${{ github.sha }} -run=${{ github.run_number }}${{ github.run_attempt }} | ||
- name: Copy to dest dir | ||
run: rsync -ah --exclude={'.git','.gitignore','.github','package.json','package-lock.json','minimize.json','node_modules','.well-known','assets','proxy16','cordova','res','build'} ./ /docker/gui/ | ||
|
||
# Build & Deploy proxy services | ||
build-proxy: | ||
needs: merge | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout git repository | ||
uses: actions/checkout@v3 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ secrets.DOCKER_HUB_USERNAME }}/proxy | ||
tags: type=raw,value=night | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./proxy16 | ||
file: ./proxy16/dockerfile | ||
builder: ${{ steps.buildx.outputs.name }} | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
|
||
deploy-proxy: | ||
needs: build-proxy | ||
runs-on: proxy.test | ||
steps: | ||
- name: Pull && Up proxy container | ||
run: /data/proxy_pre_pull_up.sh | ||
shell: bash | ||
- name: Reset nginx cache | ||
run: /data/reset_cache.sh | ||
shell: bash | ||
|
||
deploy-proxy-test: | ||
needs: build-proxy | ||
runs-on: proxy.test | ||
steps: | ||
- name: Pull && Up proxy container | ||
run: /data/proxy_test_pull_up.sh | ||
shell: bash | ||
- name: Reset nginx cache | ||
run: /data/reset_cache.sh | ||
shell: bash | ||
|
||
# Build applications | ||
build-app-macos: | ||
needs: merge | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout git repository | ||
uses: actions/checkout@v3 | ||
- name: Install Node.js, NPM and Yarn | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Prepare building | ||
run: | | ||
npm i | ||
npm run dev:bastyon -- -sha=${{ github.sha }} -run=${{ github.run_number }}${{ github.run_attempt }} | ||
- name: Prepare for app notarization | ||
run: | | ||
mkdir -p ~/private_keys/ | ||
echo '${{ secrets.APPLE_API_KEY }}' > ~/private_keys/AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8 | ||
echo '${{ secrets.APPLECERT }}' | base64 -d > applecert.p12 | ||
- name: Building | ||
env: | ||
APPLEID: ${{ secrets.APPLEID }} | ||
APPLEIDPASS: ${{ secrets.APPLEIDPASS }} | ||
API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} | ||
API_KEY_ISSUER_ID: ${{ secrets.APPLE_API_KEY_ISSUER_ID }} | ||
CSC_LINK: 'file://applecert.p12' | ||
CSC_KEY_PASSWORD: ${{ secrets.APPLECERTPWD }} | ||
run: | | ||
npm run distm | ||
ls -lh ./dist/ | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: macos | ||
path: ./dist/BastyonSetup.dmg | ||
|
||
build-app-unix: | ||
needs: merge | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout git repository | ||
uses: actions/checkout@v3 | ||
- name: Install Node.js, NPM and Yarn | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Prepare building | ||
run: | | ||
apt update && apt install -y binutils rpm | ||
npm i | ||
npm run dev:bastyon -- -sha=${{ github.sha }} -run=${{ github.run_number }}${{ github.run_attempt }} | ||
- name: Building | ||
run: | | ||
npm run distl | ||
ls -lh ./dist/ | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: unix | ||
path: | | ||
./dist/BastyonSetup.deb | ||
./dist/BastyonSetup.rpm | ||
./dist/Bastyon.AppImage | ||
build-app-windows: | ||
needs: merge | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout git repository | ||
uses: actions/checkout@v3 | ||
- name: Install Node.js, NPM and Yarn | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Prepare building | ||
run: | | ||
npm i | ||
npm run dev:bastyon -- -sha=${{ github.sha }} -run=${{ github.run_number }}${{ github.run_attempt }} | ||
- name: Building | ||
run: | | ||
npm run dist | ||
ls .\dist\ | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: windows | ||
path: ./dist/BastyonSetup.exe | ||
|
||
build-app-android: | ||
needs: merge | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout git repository | ||
uses: actions/checkout@v3 | ||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '11' | ||
- name: Install Node.js, NPM and Yarn | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Install Cordova | ||
run: | | ||
npm i -g cordova@10 | ||
cordova --version | ||
- name: Prepare building | ||
run: | | ||
npm i | ||
npm run minimize:cordova -- -sha=${{ github.sha }} -run=${{ github.run_number }}${{ github.run_attempt }} | ||
cd ./cordova | ||
npm i | ||
- name: Prepare configuration | ||
run: | | ||
cd ./cordova | ||
echo "${{ secrets.ANDROID_SECRET_KEY }}" | base64 -d > cert.keystore | ||
echo "${{ secrets.ANDROID_BUILD_CONF }}" | base64 -d > build.json | ||
echo "${{ secrets.ANDROID_FIREBASE_CONF }}" | base64 -d > google-services.json | ||
ls -l cert.keystore | ||
ls -l build.json | ||
- name: Fixing Android Build Tool Issue | ||
run: | | ||
cd $ANDROID_HOME/build-tools/33.0.0 | ||
mv d8 dx | ||
cd lib | ||
mv d8.jar dx.jar | ||
- name: Configure Cordova Plugins | ||
run: | | ||
cd ./cordova | ||
npm run android-add | ||
- name: Building | ||
run: | | ||
cd ./cordova | ||
npm run android-build | ||
- name: Rename apk binary | ||
run: | | ||
cd ./cordova/platforms/android/app/build/outputs/apk/release | ||
ls -lh | ||
mv app-release.apk Bastyon.apk | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: android | ||
path: ./cordova/platforms/android/app/build/outputs/apk/release/Bastyon.apk | ||
|
||
build-app-android-gf: | ||
needs: merge | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout git repository | ||
uses: actions/checkout@v3 | ||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '11' | ||
- name: Install Node.js, NPM and Yarn | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Install Cordova | ||
run: | | ||
npm i -g cordova@10 | ||
cordova --version | ||
- name: Prepare building | ||
run: | | ||
npm i | ||
npm run minimize:cordova:gfree -- -sha=${{ github.sha }} -run=${{ github.run_number }}${{ github.run_attempt }} | ||
cd ./cordova | ||
npm i | ||
- name: Prepare configuration | ||
run: | | ||
cd ./cordova | ||
echo "${{ secrets.ANDROID_SECRET_KEY }}" | base64 -d > cert.keystore | ||
echo "${{ secrets.ANDROID_BUILD_GFREE_CONF }}" | base64 -d > buildgfree.json | ||
echo "${{ secrets.ANDROID_FIREBASE_CONF }}" | base64 -d > google-services.json | ||
- name: Fixing Android Build Tool Issue | ||
run: | | ||
cd $ANDROID_HOME/build-tools/33.0.0 | ||
mv d8 dx | ||
cd lib | ||
mv d8.jar dx.jar | ||
- name: Configure Cordova Plugins | ||
run: | | ||
cd ./cordova | ||
npm run android-add | ||
- name: Building | ||
run: | | ||
cd ./cordova | ||
npm run android-build-gfree | ||
- name: Rename apk binary | ||
run: | | ||
cd ./cordova/platforms/android/app/build/outputs/apk/release | ||
ls -lh | ||
mv app-release.apk BastyonGF.apk | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: android-gfree | ||
path: ./cordova/platforms/android/app/build/outputs/apk/release/BastyonGF.apk | ||
|
||
deploy-app-binaries: | ||
needs: [ build-app-macos, build-app-unix, build-app-windows, build-app-android, build-app-android-gf ] | ||
runs-on: dev.pocketnet.app | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
- name: Copy artifacts | ||
run: cp ./**/Bastyon* /data/dev/binaries/dev/ | ||
- name: Clean work dir | ||
run: rm -rf ./* |