diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e0b2fc9..d5c0d50 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -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 }} @@ -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 @@ -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 @@ -84,6 +87,7 @@ 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)" @@ -91,12 +95,14 @@ jobs: 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 ] @@ -109,9 +115,8 @@ 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 }}/. @@ -119,7 +124,7 @@ jobs: # 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 @@ -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 @@ -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