diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2897ff9..eb80f42 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,15 +19,23 @@ jobs: ${{ steps.build-metadata.outputs.imagebuilder-name }} imagebuilder-url: ${{ steps.build-metadata.outputs.imagebuilder-url }} + cache-key: + ${{ steps.cache-key.outputs.cache-key }} steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-tags: true fetch-depth: 0 + submodules: true - name: Determine Version id: build-metadata run: bash $GITHUB_WORKSPACE/contrib/get-version.sh + - name: Determine Cache-Key + id: cache-key + run: > + echo "cache-key=$(bash $GITHUB_WORKSPACE/contrib/cache-key.sh + $GITHUB_WORKSPACE ${{ steps.build-metadata.outputs.sdk-url }})" >> "$GITHUB_OUTPUT" - name: Create Artifact of build-meta uses: actions/upload-artifact@v4 with: @@ -50,8 +58,7 @@ jobs: - name: Determine Cache-Key id: cache-key-sdk run: > - echo "cache-key=$(bash $GITHUB_WORKSPACE/contrib/cache-key.sh - $GITHUB_WORKSPACE ${{ needs.build-meta.outputs.sdk-url }})" >> "$GITHUB_OUTPUT" + echo "cache-key=sdk-${{ needs.build-meta.outputs.sdk-url }})" >> "$GITHUB_OUTPUT" - name: Restore Cache id: restore-cache-sdk uses: actions/cache/restore@v4 @@ -125,9 +132,19 @@ jobs: - name: Show binary output directory structure run: | tree /tmp/packages + - name: Determine Cache-Key + id: cache-key-ib + run: > + echo "cache-key=ib-${{ needs.build-meta.outputs.sdk-url }})" >> "$GITHUB_OUTPUT" - name: Install dependencies run: | $GITHUB_WORKSPACE/contrib/install-deps.sh + - name: Restore Cache + id: restore-cache-ib + uses: actions/cache/restore@v4 + with: + path: /tmp/openwrt-imagebuilder + key: ${{ steps.cache-key-ib.outputs.cache-key }} - name: Download Imagebuilder run: | curl -o /tmp/openwrt-imagebuilder.tar.xz ${{ needs.build-meta.outputs.imagebuilder-url }} @@ -135,6 +152,12 @@ jobs: run: | tar -xf /tmp/openwrt-imagebuilder.tar.xz -C /tmp mv /tmp/${{ needs.build-meta.outputs.imagebuilder-name }} /tmp/openwrt-imagebuilder + - name: Save cache + id: save-cache-ib + uses: actions/cache/save@v4 + with: + path: /tmp/openwrt-imagebuilder + key: ${{ steps.cache-key-ib.outputs.cache-key }} - name: Link repositories run: | sed -i '/^option check_signature/d' /tmp/openwrt-imagebuilder/repositories.conf diff --git a/contrib/cache-key-sdk.sh b/contrib/cache-key.sh similarity index 100% rename from contrib/cache-key-sdk.sh rename to contrib/cache-key.sh