Skip to content

Commit

Permalink
Fix pre-release job of workflow (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
madelen-at-work authored Apr 12, 2024
1 parent b0cb95e commit 35e523e
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
strip_sha=${sha:0:7}
echo "SHORT_SHA=${strip_sha}" >> $GITHUB_ENV
- uses: actions/cache@v4
if: ${{ (github.ref_type == 'tag') || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
with:
path: ${{ github.workspace }}/build-${{ matrix.arch }}
key: key-${{ env.SHORT_SHA }}-${{ matrix.arch }}
Expand All @@ -60,6 +61,7 @@ jobs:
get_version: "true"
- name: Get changes for manifest
id: manifest-settings
if: ${{ (github.ref_type == 'tag') || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
run: |
if [ ${{github.ref_type}} == tag ]; then
echo "version_value=${{ steps.meta.outputs.version }}" >> $GITHUB_OUTPUT
Expand All @@ -69,6 +71,7 @@ jobs:
echo "append_sha='true'" >> $GITHUB_OUTPUT
fi
- name: Update manifest file
if: ${{ (github.ref_type == 'tag') || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
uses: ./.github/actions/update-acap-manifest-action
with:
manifest_file: ./app/manifest.json
Expand All @@ -84,19 +87,22 @@ jobs:
outputs: "type=local,dest=build"
- name: Get name of EAP-file
id: get_eap_file_name
if: ${{ (github.ref_type == 'tag') || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
run: |
export EAP_FILE=$(find build -type f -name "*.eap" -printf "%f\n")
delimiter="$(openssl rand -hex 8)"
echo "EAP_FILE<<${delimiter}" >> ${GITHUB_ENV}
echo "${EAP_FILE}" >> ${GITHUB_ENV}
echo "${delimiter}" >> ${GITHUB_ENV}
- name: Add sha to EAP-file name
if: ${{ (github.ref_type == 'tag') || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
run: |
eap_file_w_sha=$(echo $"${{ env.EAP_FILE }}" | sed 's/\.eap/_${{ env.SHORT_SHA }}.eap/')
echo "EAP_FILE_W_SHA=${eap_file_w_sha}" >> $GITHUB_ENV
cp build/${{ env.EAP_FILE }} build/$eap_file_w_sha
- name: Save full file name
id: save_full_file_name
if: ${{ (github.ref_type == 'tag') || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
run: |
echo "SHORT_SHA=${{ env.SHORT_SHA }}" >> $GITHUB_OUTPUT
if [ ${{ matrix.arch }} = armv7hf ]
Expand All @@ -109,17 +115,16 @@ jobs:
echo "::error::Non valid architecture '${{ matrix.arch }}' encountered"
fi
- name: Move EAP-file to cache location
if: ${{ (github.ref_type == 'tag') || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
run: |
echo "The eap-file is: ${{ env.EAP_FILE_W_SHA }}"
echo "Workspace dir is ${{ github.workspace }}"
mkdir -p ${{ github.workspace }}/build-${{ matrix.arch }}
#rm -f ${{ github.workspace }}/build-${{ matrix.arch }}/${{ env.EAP_FILE_W_SHA }}
mv build/${{ env.EAP_FILE_W_SHA }} ${{ github.workspace }}/build-${{ matrix.arch }}/.
# Sign the eap-file from the build
sign-eap:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
if: ${{ (github.ref_type == 'tag') || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
needs: build
permissions:
contents: write
Expand All @@ -132,6 +137,9 @@ jobs:
EAP_FILE_AARCH64: ${{ needs.build.outputs.EAP_FILE_AARCH64 }}
EAP_FILE_ARMV7HF: ${{ needs.build.outputs.EAP_FILE_ARMV7HF }}
SHORT_SHA: ${{ needs.build.outputs.SHORT_SHA }}
outputs:
EAP_FILE_ARMV7HF: ${{ steps.save_full_file_name.outputs.EAP_FILE_ARMV7HF }}
EAP_FILE_AARCH64: ${{ steps.save_full_file_name.outputs.EAP_FILE_AARCH64 }}
steps:
- name: Get EAP file name
id: full_eap_name
Expand Down Expand Up @@ -239,14 +247,14 @@ jobs:
permissions:
contents: write
runs-on: ubuntu-latest
needs: [create_prerelease, build]
needs: [create_prerelease, build, sign-eap]
strategy:
matrix:
arch: [armv7hf, aarch64]
env:
RELEASE_ID: ${{ needs.create_prerelease.outputs.RELEASE_ID }}
EAP_FILE_AARCH64: ${{ needs.build.outputs.EAP_FILE_AARCH64 }}
EAP_FILE_ARMV7HF: ${{ needs.build.outputs.EAP_FILE_ARMV7HF }}
EAP_FILE_AARCH64: ${{ needs.sign-eap.outputs.EAP_FILE_AARCH64 }}
EAP_FILE_ARMV7HF: ${{ needs.sign-eap.outputs.EAP_FILE_ARMV7HF }}
steps:
- name: Get EAP file name
id: full_eap_name
Expand Down

0 comments on commit 35e523e

Please sign in to comment.