Skip to content

Commit

Permalink
Update app-prebuild.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
kazami139 authored and GitHub Enterprise committed Feb 16, 2023
1 parent bda052d commit fd66cbe
Showing 1 changed file with 49 additions and 25 deletions.
74 changes: 49 additions & 25 deletions .github/workflows/app-prebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ name: EOEFANS PRE-BUILD App CI
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
branches: [ "main","ci" ]
tags: [ "v*" ]
# pull_request:
# branches: [ "main" ]
# branches: [ "main","ci" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }}
ACCOUNT_NAME: eoefans01
ACCOUNT_KEY: ${{ secrets.STORAGE_ACCOUNT_KEY }}
SHARE_NAME: eoefans-client-dev # change for dev and prod
SHARE_NAME_PROD: eoefans-client # change for dev and prod
SOURCE_DIR: upload-ready
SOURCE_DIR_PROD: upload-ready-prod
# IMAGE_TAG: "" #we get tag using the action down below

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
Expand All @@ -30,8 +36,18 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Get tag
if: startsWith(github.ref, 'refs/tags/')
id: tag
uses: dawidd6/action-get-tag@v1
- name: set tag to env
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "IMAGE_TAG=${{steps.tag.outputs.tag}}" >> $GITHUB_ENV
echo $GITHUB_ENV
- uses: actions/setup-java@v3
with:
distribution: "zulu"
Expand All @@ -57,34 +73,42 @@ jobs:
run: |
ls -la
ls -la build/app/outputs/apk/release
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1

- run: |
echo "IMAGE_TAG=${{steps.tag.outputs.tag}}" >> $GITHUB_ENV
echo $GITHUB_ENV
- name: upload apk
uses: actions/upload-artifact@v3
with:
name: app-release.apk
path: build/app/outputs/apk/release/app-release.apk

- name: upload all artifacts
uses: actions/upload-artifact@v3
- name: move and rename artifacts
run: |
mkdir upload-ready
cp build/app/outputs/apk/release/* upload-ready
cd upload-ready && for file in *; do mv "$file" "${{ github.run_number }}-$file"; done && cd ..
ls -la upload-ready
- name: upload to azure file for dev environment
uses: cahaseler/azure-fileshare-upload@v1.0.0
with:
name: all.zip
path: build/app/outputs/apk/release/
account_name: ${{ env.ACCOUNT_NAME }}
account_key: ${{ env.ACCOUNT_KEY }}
share_name: ${{ env.SHARE_NAME }}
source_dir: ${{ env.SOURCE_DIR }}



- name: rename apk
if: startsWith(github.ref, 'refs/tags/')
run: mv build/app/outputs/apk/release/app-release.apk build/app/outputs/apk/release/EOEFANS-${{ env.IMAGE_TAG }}.apk
run: |
mkdir upload-ready-prod
mv build/app/outputs/apk/release/app-release.apk upload-ready-prod/EOEFANS-${{ env.IMAGE_TAG }}.apk
- name: Publish release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: build/app/outputs/apk/release/EOEFANS-${{ env.IMAGE_TAG }}.apk
files: upload-ready-prod/EOEFANS-${{ env.IMAGE_TAG }}.apk

- name: upload to azure file for prod environment
if: startsWith(github.ref, 'refs/tags/')
uses: cahaseler/azure-fileshare-upload@v1.0.0
with:
account_name: ${{ env.ACCOUNT_NAME }}
account_key: ${{ env.ACCOUNT_KEY }}
share_name: ${{ env.SHARE_NAME_PROD }}
source_dir: ${{ env.SOURCE_DIR_PROD }}

0 comments on commit fd66cbe

Please sign in to comment.