After the Dockerfile refactor into multi-stage (commit 6f975f87),
'docker build .' without --target selects the LAST stage of the
Dockerfile — which is blogs-runtime, an ASP.NET image with no
APK to extract. The subsequent docker cp command then fails
with:
Error: No such container:path: …PostIt.Android/bin/Release/
net10.0-android/android-arm64/com.CompanyName.PostIt-Signed.apk
Add --target build-env to scope the build to the build-env stage
(the one that produces both the .apk and the publish artifacts,
and which still ends with CMD ["bash"]).
36 lines
1.3 KiB
YAML
36 lines
1.3 KiB
YAML
name: Build and Push Yavsc Apk
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
apk-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout du code
|
|
uses: actions/checkout@v7
|
|
|
|
# 1. Votre étape de build actuelle (on nomme l'image "postit-android")
|
|
# --target build-env : on ne veut que le stage de build (qui
|
|
# contient les artefacts .apk). Sans --target, Docker ciblerait
|
|
# le DERNIER stage du Dockerfile (blogs-runtime, qui est une
|
|
# image ASP.NET runtime sans aucun APK à extraire).
|
|
- name: Build de l'image Docker
|
|
run: docker build --build-arg ANDROID_TARGET_RID=android-arm64 --target build-env -t postit-android .
|
|
# 2. EXTRACTION : Créer un conteneur éphémère pour copier l'APK vers l'hôte GitHub
|
|
- name: Extraire l'APK du conteneur Docker
|
|
run: |
|
|
docker create --name extractor postit-android
|
|
docker cp extractor:/src/src/PostIt/PostIt.Android/bin/Release/net10.0-android/android-arm64/com.CompanyName.PostIt-Signed.apk ./PostIt.Android.apk
|
|
docker rm extractor
|
|
|
|
- name: Téléverser l'APK en tant qu'Artéfact GitHub
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: application-apk-release
|
|
path: ./PostIt.Android.apk
|
|
retention-days: 7
|
|
|