Skip to content

SwapLab Build Service Android/IOS #83

SwapLab Build Service Android/IOS

SwapLab Build Service Android/IOS #83

# File name: .github/workflows/swaplab-workflow-no-cache.yml
# ======================================================================================
# NOTE: DO NOT RENAME THIS FILE.
# The workflow ID "swaplab-workflow-no-cache.yml" is required for the SaaS integration.
# Changing the filename will break the connection with the build server.
# ======================================================================================
# This workflow is managed by the SaaS build service
name: SwapLab Build Service Android/IOS
on:
# Manual trigger invoked by the SaaS Server
workflow_dispatch:
inputs:
appBaseUrl:
required: true
buildId:
required: true
imageName:
description: 'The name of the build engine image'
required: true
default: ''
ref:
description: 'The image tag to use for the build engine'
required: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write # Required for secure OIDC authentication
contents: write
steps:
# 1. Checkout source code
- name: Checkout Repository
uses: actions/checkout@v6
# 3. Generate temporary identity token for secure server authentication
# https://docs.github.com/en/actions/concepts/security/openid-connect
- name: Get GitHub OIDC Token
id: get_token
run: |
AUDIENCE=${{ inputs.appBaseUrl }}
OIDC_TOKEN=$(curl -sfL -H "Authorization: Bearer ${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" "${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=${AUDIENCE}" | jq -r .value)
echo "token=${OIDC_TOKEN}" >> $GITHUB_OUTPUT
# 4. Execute the build engine in an isolated container
- name: SwapLab Run Build Android Engine
run: |
docker run --rm -i \
-e INPUT_APPBASEURL=${{ inputs.appBaseUrl }} \
-e INPUT_BUILDID=${{ inputs.buildId }} \
-e GITHUB_OIDC_TOKEN=${{ steps.get_token.outputs.token }} \
-e GITHUB_SERVER_URL=${{ github.server_url }} \
-e GITHUB_REPOSITORY=${{ github.repository }} \
-e GITHUB_RUN_ID=${{ github.run_id }} \
ghcr.io${{ github.event.inputs.imageName }}:${{ github.event.inputs.ref }}