Fixed Widget / Sweep can play in opposite phase / Update nuget.csv / … #74
Workflow file for this run
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
name: CI on Push and Pull Request | |
on: | |
push: | |
tags: 'v*' | |
workflow_dispatch: | |
pull_request: | |
jobs: | |
Android: | |
runs-on: windows-latest | |
env: | |
SlnPath: D:\a/e/ | |
SlnPathBash: /d/a/e/ | |
SlnPathOriginal: Earphone/ | |
AndroidCsprojPath: EarphoneLeftAndRight/EarphoneLeftAndRight.Android/ | |
AndroidCsprojName: EarphoneLeftAndRight.Android.csproj | |
AndroidAppName: com.github.kurema.earphoneleftandright | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Move directory | |
run: Move-Item ${{ env.SlnPathOriginal }} ${{env.SlnPath}} | |
# For Windows | |
- name: Add msbuild to PATH | |
uses: microsoft/[email protected] | |
- name: Write keystore | |
run: | | |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.KEYSTORE_BASE64_ENCODED }}") | |
[IO.File]::WriteAllBytes("${{ env.SlnPath }}${{ env.AndroidCsprojPath }}github.keystore", $pfx_cert_byte) | |
- name: Get tag | |
id: tag | |
if: contains(github.ref, 'tags/v') | |
uses: dawidd6/action-get-tag@v1 | |
- name: Replace Ad Unit ID | |
shell: bash | |
run: | | |
sed -i -e "s@$ADMOB_OLD@$ADMOB_NEW@g" ${{ env.SlnPathBash }}${{ env.AndroidCsprojPath }}AdMobBannerRenderer.cs | |
env: | |
ADMOB_OLD: ca-app-pub-3940256099942544/6300978111 | |
ADMOB_NEW: ${{ secrets.ADMOB_UNIT_ID_BANNER }} | |
- name: Is tagged version | |
id: tagged | |
run: echo '::set-output name=tagged::yes' | |
#https://pione30.hatenablog.com/entry/2021/02/05/015545 | |
if: contains(github.ref, 'tags/v') | |
- name: Require Android package format | |
id: apf | |
shell: bash | |
run: | | |
if [ "${{steps.tagged.outputs.tagged}}" = "yes" ]; then | |
echo '::set-output name=format::aab' | |
else | |
echo '::set-output name=format::apk' | |
fi | |
- name: Android | |
run: | | |
cd ${{ env.SlnPath }} | |
nuget restore | |
msbuild ${{ env.AndroidCsprojPath }}${{ env.AndroidCsprojName }} /verbosity:normal /t:Rebuild /t:PackageForAndroid /t:SignAndroidPackage /p:Configuration=Release /p:AndroidKeyStore=True /p:AndroidSigningKeyStore=github.keystore /p:AndroidSigningStorePass=${{ secrets.KEYSTORE_PASSWORD }} /p:AndroidSigningKeyAlias=github /p:AndroidSigningKeyPass=${{ secrets.KEYSTORE_PASSWORD }} /p:AndroidPackageFormat=${{ steps.apf.outputs.format }} /p:AotAssemblies=true /p:EnableLLVM=true | |
- name: Build Apk version | |
run: | | |
cd ${{ env.SlnPath }} | |
msbuild ${{ env.AndroidCsprojPath }}${{ env.AndroidCsprojName }} /verbosity:quiet /t:Build /t:PackageForAndroid /t:SignAndroidPackage /p:Configuration=Release /p:AndroidKeyStore=True /p:AndroidSigningKeyStore=github.keystore /p:AndroidSigningStorePass=${{ secrets.KEYSTORE_PASSWORD }} /p:AndroidSigningKeyAlias=github /p:AndroidSigningKeyPass=${{ secrets.KEYSTORE_PASSWORD }} /p:AndroidPackageFormat=apk /p:AotAssemblies=true /p:EnableLLVM=true | |
if: contains(github.ref, 'tags/v') | |
- name: Delete keystore | |
run: | | |
rm ${{ env.SlnPath }}${{ env.AndroidCsprojPath }}github.keystore | |
if: always() | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: Android App | |
path: ${{ env.SlnPath }}${{ env.AndroidCsprojPath }}bin/Release/${{ env.AndroidAppName }}-Signed.* | |
if: ${{ !contains(github.ref, 'tags/v') }} | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: contains(github.ref, 'tags/v') | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{steps.tag.outputs.tag}} | |
draft: false | |
prerelease: false | |
- name: Update release asset | |
uses: actions/upload-release-asset@v1 | |
if: contains(github.ref, 'tags/v') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ env.SlnPath }}${{ env.AndroidCsprojPath }}bin/Release/${{ env.AndroidAppName }}-Signed.aab | |
asset_name: ${{ env.AndroidAppName }}-Signed.aab | |
asset_content_type: application/zip | |
- name: Update release asset Apk | |
uses: actions/upload-release-asset@v1 | |
if: contains(github.ref, 'tags/v') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ env.SlnPath }}${{ env.AndroidCsprojPath }}bin/Release/${{ env.AndroidAppName }}-Signed.apk | |
asset_name: ${{ env.AndroidAppName }}-Signed.apk | |
asset_content_type: application/zip | |
- name: Delete moved directory | |
run: | | |
Remove-Item -Path ${{ env.SlnPath }}* -Recurse | |
if: always() |