Skip to content

all-v1.15.6-beta

all-v1.15.6-beta #55

Workflow file for this run

# Triggers a new deployment when a release starting with "fe1-" is created.
name: Release and deployment
on:
release:
types: [published]
jobs:
deploy_fe1:
name: Release and deploy fe1-web
if: ${{ startsWith(github.event.release.tag_name, 'fe1-') || startsWith(github.event.release.tag_name, 'all-') }}
runs-on: ubuntu-latest
env:
base_folder: fe1-web
deploy_env: ${{ github.event.release.prerelease && 'dev' || 'prod' }}
defaults:
run:
working-directory: ./${{ env.base_folder }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
# Save some build information to inject into the APP
- name: Get the version
id: get_version
run: |
echo ::set-output name=version::$(echo ${GITHUB_REF/refs\/tags\//})
echo ::set-output name=version_file::$(echo ${GITHUB_REF/refs\/tags\//} | tr . _)
echo "::set-output name=shortsha::$(git rev-parse --short ${GITHUB_SHA})"
echo "::set-output name=buildurl::${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}"
echo "::set-output name=date::$(date +'%d/%m/%y %H:%M')"
- name: install
run: |
npm install
# Will create a 'web-build/' folder containing the App
- name: transpile
env:
APP_VERSION: ${{ steps.get_version.outputs.version }}
APP_SHORT_SHA: ${{ steps.get_version.outputs.shortsha }}
APP_BUILD_URL: ${{ steps.get_version.outputs.buildurl }}
APP_BUILD_DATE: ${{ steps.get_version.outputs.date }}
run: |
npm run build-web
- name: Create tar.gz
run: |
tar -czvf fe1_web_${{ steps.get_version.outputs.version_file }}.tar.gz ./web-build
- name: Upload release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ env.base_folder }}/fe1_web_${{ steps.get_version.outputs.version_file }}.tar.gz
# Use rsync to deploy the new website
- name: Sync
env:
dest: "popdemo@${{secrets.POPDEMO_DEPLOY_ADDR}}:${{ env.deploy_env }}/fe1-web/"
run: |
echo "${{secrets.POPDEMO_DEPLOY_KEY}}" > deploy_key
chmod 600 ./deploy_key
rsync -chav --delete \
-e 'ssh -p ${{secrets.POPDEMO_DEPLOY_PORT}} -i ./deploy_key -o StrictHostKeyChecking=no' \
./web-build/ ${{env.dest}}
deploy_be1:
name: Release and deploy be1-go
if: ${{ startsWith(github.event.release.tag_name, 'be1-') || startsWith(github.event.release.tag_name, 'all-') }}
runs-on: ubuntu-latest
env:
base_folder: be1-go
deploy_env: ${{ github.event.release.prerelease && 'dev' || 'prod' }}
defaults:
run:
working-directory: ./${{ env.base_folder }}
steps:
- uses: actions/checkout@v3
- name: Use go >= 1.21
uses: actions/setup-go@v3
with:
go-version: ">=1.21"
- name: build
run: |
make build
- name: Upload release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ env.base_folder }}/pop-*
# Use rsync to deploy the new website
- name: Sync
env:
dest: "popdemo@${{secrets.POPDEMO_DEPLOY_ADDR}}:${{ env.deploy_env }}/be1-go/"
run: |
echo "${{secrets.POPDEMO_DEPLOY_KEY}}" > deploy_key
chmod 600 ./deploy_key
rsync -chav --delete \
-e 'ssh -p ${{secrets.POPDEMO_DEPLOY_PORT}} -i ./deploy_key -o StrictHostKeyChecking=no' \
./pop ${{env.dest}}
deploy_be2:
name: Release and deploy be2-scala
if: ${{ startsWith(github.event.release.tag_name, 'be2-') || startsWith(github.event.release.tag_name, 'all-') }}
runs-on: ubuntu-latest
env:
base_folder: be2-scala
deploy_env: ${{ github.event.release.prerelease && 'dev' || 'prod' }}
scala_version: 3.3.1
defaults:
run:
working-directory: ./${{ env.base_folder }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: "temurin"
java-version: "17"
- name: build
run: |
sbt assembly
- name: Upload release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ env.base_folder }}/target/scala-${{ env.scala_version }}/pop-assembly-*
- name: Copy jar
run: |
find target/scala-${{ env.scala_version }} -type f -name 'pop-assembly-*' -exec sh -c 'x="{}"; cp "$x" "pop-scala.jar"' \;
# Use rsync to deploy the new website
- name: Sync
env:
dest: "popdemo@${{secrets.POPDEMO_DEPLOY_ADDR}}:${{ env.deploy_env }}/be2-scala/"
run: |
echo "${{secrets.POPDEMO_DEPLOY_KEY}}" > deploy_key
chmod 600 ./deploy_key
rsync -chav --delete \
-e 'ssh -p ${{secrets.POPDEMO_DEPLOY_PORT}} -i ./deploy_key -o StrictHostKeyChecking=no' \
./pop-scala.jar ${{env.dest}}
deploy_fe2:
name: Release and deploy fe2-android
if: ${{ startsWith(github.event.release.tag_name, 'fe2-') || startsWith(github.event.release.tag_name, 'all-') }}
runs-on: ubuntu-latest
env:
base_folder: fe2-android
deploy_env: ${{ github.event.release.prerelease && 'dev' || 'prod' }}
app_name: pop
defaults:
run:
working-directory: ./${{ env.base_folder }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: "temurin"
java-version: "17"
# Cache the build process
- name: Cache Gradle
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: Change wrapper permissions
run: chmod +x ./gradlew
# Get version tag
- name: Get the release version
id: get_version
run: |
echo ::set-output name=version::$(echo ${GITHUB_REF/refs\/tags\//})
# Run Build Project
- name: Build gradle project
run: ./gradlew build --build-cache --parallel
# Create APK Debug
- name: Build apk debug project (APK)
run: ./gradlew assembleDebug
- name: Rename APK debug
run: mv $(pwd)/app/build/outputs/apk/debug/app-debug.apk $(pwd)/app/build/outputs/apk/debug/${{ env.app_name }}-${{ steps.get_version.outputs.version }}.apk
# Upload the APKs
- name: APK Debug
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ env.base_folder }}/app/build/outputs/apk/debug/${{ env.app_name }}-${{ steps.get_version.outputs.version }}.apk
# Use rsync to deploy the release apk on the website
- name: Sync
env:
dest: "popdemo@${{secrets.POPDEMO_DEPLOY_ADDR}}:dev/fe2-android/"
run: |
echo "${{secrets.POPDEMO_DEPLOY_KEY}}" > deploy_key
chmod 600 ./deploy_key
rsync -chav --delete \
-e 'ssh -p ${{secrets.POPDEMO_DEPLOY_PORT}} -i ./deploy_key -o StrictHostKeyChecking=no' \
$(pwd)/app/build/outputs/apk/debug/${{ env.app_name }}-${{ steps.get_version.outputs.version }}.apk ${{env.dest}}
deploy_popcha_example_client:
name: Deploy the example PoPCHA client
if: ${{ startsWith(github.event.release.tag_name, 'example-') || startsWith(github.event.release.tag_name, 'all-') }}
runs-on: ubuntu-latest
env:
base_folder: demo/popcha-client/web
deploy_env: ${{ github.event.release.prerelease && 'dev' || 'prod' }}
steps:
- uses: actions/checkout@v3
# Use rsync to deploy the new website (no build is necessary)
- name: Sync
env:
dest: "popdemo@${{secrets.POPDEMO_DEPLOY_ADDR}}:dev/popcha/"
run: |
echo "${{secrets.POPDEMO_DEPLOY_KEY}}" > deploy_key
chmod 600 ./deploy_key
rsync -chav --delete \
-e 'ssh -p ${{secrets.POPDEMO_DEPLOY_PORT}} -i ./deploy_key -o StrictHostKeyChecking=no' \
./${{ env.base_folder }} ${{ env.dest }}