-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
390 additions
and
36 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
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
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,31 @@ | ||
name: Check apk version | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
is-new-apk-version: | ||
value: ${{ jobs.need-new-version-apk.outputs.need-new-apk }} | ||
env: | ||
apk_name: app-release.apk | ||
|
||
jobs: | ||
need-new-version-apk: | ||
runs-on: [ubuntu-latest] | ||
outputs: | ||
need-new-apk: ${{ steps.get-existing-apk.outputs.need-new-apk }} | ||
steps: | ||
- name: Get APK version | ||
id: get-apk-version | ||
run: | | ||
echo "apk-version=$(grep -oP "versionName \"\K[^\"]*" android/app/build.gradle)" >> $GITHUB_OUTPUT | ||
- name: Get existing APK | ||
id: get-existing-apk | ||
run: | | ||
aws s3 cp s3://${{ vars.S3_BUCKET }}/storybook-smartapp/${{ steps.get-apk-version.outputs.apk-version }}/${{ env.apk_name }} android/app/build/outputs/apk/release/${{ env.apk_name }} && { | ||
echo "Apk already exist for that version" | ||
echo "need-new-apk=false" >> $GITHUB_OUTPUT | ||
} || { | ||
echo "Apk does not exist for that version, need build a new one" | ||
echo "need-new-apk=true" >> $GITHUB_OUTPUT | ||
} |
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,20 @@ | ||
name: 'FormatVersionCode' | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
version-code: | ||
description: 'Version code generated' | ||
value: ${{ jobs.format-version-code.outputs.version-code }} | ||
|
||
jobs: | ||
format-version-code: | ||
name: Format Version Code | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
version-code: ${{ steps.version-code.outputs.value }} | ||
steps: | ||
- name: 'Format build number for Android VersionCode' | ||
id: version-code | ||
run: echo "value=`printf '%04o\n' ${{ github.run_number }}`" >> $GITHUB_OUTPUT |
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,77 @@ | ||
name: 'Bundle JS' | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
node-version: | ||
required: true | ||
type: string | ||
codepush-app: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
bundle-js: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
defaults: | ||
run: | ||
working-directory: ./Storybook | ||
steps: | ||
- name: Tailscale | ||
uses: tailscale/github-action@v2 | ||
with: | ||
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} | ||
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} | ||
tags: tag:ci | ||
version: ${{ vars.TAILSCALE_VERSION }} | ||
|
||
- name: Import Secrets | ||
id: imported-secrets | ||
uses: hashicorp/vault-action@v2 | ||
with: | ||
url: ${{ vars.VAULT_URL }} | ||
role: ${{ vars.VAULT_GITHUB_ACTIONS_ROLE }} | ||
method: jwt | ||
path: 'github-actions' | ||
secrets: | | ||
secret/data/storybook-smartapp CODE_PUSH_KEY_NAME | STORYBOOK_CODE_PUSH_KEY_NAME ; | ||
secret/data/storybook-smartapp CODE_PUSH_TOKEN | STORYBOOK_CODE_PUSH_TOKEN ; | ||
- name: Clean Workspace | ||
uses: mickem/clean-after-action@v2 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
registry-url: 'https://npm.pkg.github.com' | ||
scope: '@ZeroGachis' | ||
|
||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Rebuild & Prepare dependencies | ||
run: npm rebuild && npm run prepare --if-present | ||
|
||
- name: Install App center | ||
run: npm install -g appcenter-cli | ||
|
||
- name: App center login | ||
run: appcenter login --token ${{ steps.imported-secrets.outputs.STORYBOOK_CODE_PUSH_TOKEN }} | ||
|
||
- name: Deploy code push | ||
run: | | ||
appcenter codepush release-react -a ${{ inputs.codepush-app }} -d ${{ steps.imported-secrets.outputs.STORYBOOK_CODE_PUSH_KEY_NAME }} || { | ||
if [[ $? -eq 3 ]] ; then | ||
echo "Code push deploy skipped." | ||
exit 0 | ||
fi | ||
exit $? | ||
} |
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,40 @@ | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
publish: | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
registry-url: 'https://npm.pkg.github.com' | ||
scope: '@ZeroGachis' | ||
|
||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Rebuild & Prepare dependencies | ||
run: npm rebuild && npm run prepare --if-present | ||
|
||
- name: Update package version | ||
uses: mingjun97/file-regex-replace@v1 | ||
with: | ||
regex: '"version": "([0-9.]*)"' | ||
replacement: '"version": "${{ github.ref_name }}"' | ||
include: 'package.json' | ||
|
||
- name: Compile | ||
run: npm run tsc | ||
|
||
- name: Publish | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,38 @@ | ||
name: Publish S3 | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
apk-artifact-name: | ||
required: true | ||
type: string | ||
apk-name: | ||
required: true | ||
type: string | ||
apk-version: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
publish-s3: | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- name: Clean Workspace | ||
uses: mickem/clean-after-action@v2 | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1-node16 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: eu-west-1 | ||
|
||
- name: Download Artefact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ inputs.artifact-name }} | ||
path: ${{ github.workspace }}/artifact/ | ||
|
||
- name: Push Apk to S3 | ||
working-directory: 'artifact' | ||
run: aws s3 cp ${{ inputs.apk-name }} s3://${{ vars.S3_BUCKET }}/react-native/${{ inputs.apk-version }}/${{ inputs.apk-name }} |
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,44 @@ | ||
name: Publish Soti | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
type: string | ||
apk-name: | ||
required: true | ||
type: string | ||
apk-artifact-name: | ||
required: true | ||
type: string | ||
jobs: | ||
publish-soti: | ||
name: Publish APK on Soti | ||
environment: ${{ inputs.environment }} | ||
runs-on: [self-hosted, python] | ||
|
||
steps: | ||
- name: Clean Workspace | ||
uses: mickem/clean-after-action@v2 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Download APK | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ inputs.apk-artifact-name }} | ||
path: ${{ github.workspace }}/artifact/ | ||
|
||
- name: Publish APK on SOTI | ||
working-directory: scripts/soti | ||
run: | | ||
pip3 install --user -r requirements.txt \ | ||
&& python3 upload-package.py \ | ||
"${{ secrets.SOTI_API_URL }}" \ | ||
"${{ github.workspace }}/artifact/${{ inputs.apk-name }}" \ | ||
"${{ secrets.SOTI_API_KEY }}" \ | ||
"${{ secrets.SOTI_API_SECRET }}" \ | ||
"${{ secrets.SOTI_USERNAME }}" \ | ||
"${{ secrets.SOTI_PASSWORD }}" |
Oops, something went wrong.