diff --git a/.forgejo/actions/timelord/action.yml b/.forgejo/actions/timelord/action.yml index 40c6d0a6..240cb2c3 100644 --- a/.forgejo/actions/timelord/action.yml +++ b/.forgejo/actions/timelord/action.yml @@ -27,25 +27,28 @@ runs: echo "TIMELORD_KEY=${{ inputs.key || format('timelord-v1-{0}-{1}', github.repository, hashFiles('**/*.rs', '**/Cargo.toml', '**/Cargo.lock')) }}" >> $GITHUB_ENV echo "TIMELORD_PATH=${{ inputs.path || '.' }}" >> $GITHUB_ENV echo "TIMELORD_CACHE_PATH=$HOME/.cache/timelord" >> $GITHUB_ENV + echo "PATH=/usr/share/rust/.cargo/bin:$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV - name: Restore binary cache id: binary-cache uses: actions/cache/restore@v4 with: - path: /usr/share/rust/.cargo/bin - key: timelord-binaries-v1 + path: | + /usr/share/rust/.cargo/bin + ~/.cargo/bin + key: timelord-binaries-v2 - name: Check if binaries need installation shell: bash id: check-binaries run: | NEED_INSTALL=false - if [ ! -e /usr/share/rust/.cargo/bin/timelord ]; then - echo "timelord-cli not found at /usr/share/rust/.cargo/bin/timelord, needs installation" + if [ ! -e /usr/share/rust/.cargo/bin/timelord ] && [ ! -e ~/.cargo/bin/timelord ]; then + echo "timelord-cli not found in /usr/share/rust/.cargo/bin or ~/.cargo/bin, needs installation" NEED_INSTALL=true fi - if [ ! -e /usr/share/rust/.cargo/bin/git-warp-time ]; then - echo "git-warp-time not found at /usr/share/rust/.cargo/bin/git-warp-time, needs installation" + if [ ! -e /usr/share/rust/.cargo/bin/git-warp-time ] && [ ! -e ~/.cargo/bin/git-warp-time ]; then + echo "git-warp-time not found in /usr/share/rust/.cargo/bin or ~/.cargo/bin, needs installation" NEED_INSTALL=true fi echo "need-install=$NEED_INSTALL" >> $GITHUB_OUTPUT @@ -60,8 +63,10 @@ runs: if: steps.check-binaries.outputs.need-install == 'true' uses: actions/cache/save@v4 with: - path: /usr/share/rust/.cargo/bin - key: timelord-binaries-v1 + path: | + /usr/share/rust/.cargo/bin + ~/.cargo/bin + key: timelord-binaries-v2 - name: Restore timelord cache with fallbacks @@ -80,9 +85,9 @@ runs: echo "Complete timelord cache miss - running git-warp-time" git fetch --unshallow if [ "${{ env.TIMELORD_PATH }}" = "." ]; then - /usr/share/rust/.cargo/bin/git-warp-time --quiet + git-warp-time --quiet else - /usr/share/rust/.cargo/bin/git-warp-time --quiet ${{ env.TIMELORD_PATH }} + git-warp-time --quiet ${{ env.TIMELORD_PATH }} fi echo "Git timestamps restored" @@ -90,7 +95,7 @@ runs: shell: bash run: | mkdir -p ${{ env.TIMELORD_CACHE_PATH }} - /usr/share/rust/.cargo/bin/timelord sync --source-dir ${{ env.TIMELORD_PATH }} --cache-dir ${{ env.TIMELORD_CACHE_PATH }} + timelord sync --source-dir ${{ env.TIMELORD_PATH }} --cache-dir ${{ env.TIMELORD_CACHE_PATH }} - name: Save updated timelord cache immediately uses: actions/cache/save@v4 diff --git a/.forgejo/workflows/release-image.yml b/.forgejo/workflows/release-image.yml index c7accff3..90ad6490 100644 --- a/.forgejo/workflows/release-image.yml +++ b/.forgejo/workflows/release-image.yml @@ -29,41 +29,12 @@ on: env: BUILTIN_REGISTRY: forgejo.ellis.link BUILTIN_REGISTRY_ENABLED: "${{ ((vars.BUILTIN_REGISTRY_USER && secrets.BUILTIN_REGISTRY_PASSWORD) || (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)) && 'true' || 'false' }}" + IMAGE_PATH: forgejo.ellis.link/continuwuation/continuwuity jobs: - define-variables: - name: "Setup Variables" - runs-on: ubuntu-latest - - outputs: - images: ${{ steps.var.outputs.images }} - images_list: ${{ steps.var.outputs.images_list }} - - steps: - - name: Setting variables - uses: https://github.com/actions/github-script@v8 - id: var - with: - script: | - const githubRepo = '${{ github.repository }}'.toLowerCase() - const repoId = githubRepo.split('/')[1] - - core.setOutput('github_repository', githubRepo) - const builtinImage = '${{ env.BUILTIN_REGISTRY }}/' + githubRepo - let images = [] - if (process.env.BUILTIN_REGISTRY_ENABLED === "true") { - images.push(builtinImage) - } else { - // Fallback to official registry for forks/PRs without credentials - images.push('forgejo.ellis.link/continuwuation/continuwuity') - } - core.setOutput('images', images.join("\n")) - core.setOutput('images_list', images.join(",")) - build-release: name: "Build ${{ matrix.slug }} (release)" runs-on: dind - needs: define-variables permissions: contents: read packages: write @@ -90,7 +61,7 @@ jobs: slug: ${{ matrix.slug }} target_cpu: "" profile: "release" - images: ${{ needs.define-variables.outputs.images }} + images: ${{ env.IMAGE_PATH }} registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }} registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }} - name: Build and push Docker image by digest @@ -114,7 +85,7 @@ jobs: # cache-to: type=gha,mode=max sbom: true outputs: | - ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' && format('type=image,"name={0}",push-by-digest=true,name-canonical=true,push=true', needs.define-variables.outputs.images_list) || format('type=image,"name={0}",push=false', needs.define-variables.outputs.images_list) }} + ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' && format('type=image,"name={0}",push-by-digest=true,name-canonical=true,push=true', env.IMAGE_PATH) || format('type=image,"name={0}",push=false', env.IMAGE_PATH) }} type=local,dest=/tmp/binaries env: SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }} @@ -130,7 +101,7 @@ jobs: merge-release: name: "Create Multi-arch Release Manifest" runs-on: dind - needs: [define-variables, build-release] + needs: build-release steps: - name: Checkout repository uses: actions/checkout@v5 @@ -141,14 +112,14 @@ jobs: with: digest_pattern: "digests-linux-{amd64,arm64}" tag_suffix: "" - images: ${{ needs.define-variables.outputs.images }} + images: ${{ env.IMAGE_PATH }} registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }} registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }} build-maxperf: name: "Build ${{ matrix.slug }} (max-perf)" runs-on: dind - needs: [define-variables, build-release] + needs: build-release permissions: contents: read packages: write @@ -177,7 +148,7 @@ jobs: slug: ${{ matrix.slug }} target_cpu: ${{ matrix.target_cpu }} profile: "release-max-perf" - images: ${{ needs.define-variables.outputs.images }} + images: ${{ env.IMAGE_PATH }} registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }} registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }} - name: Build and push max-perf Docker image by digest @@ -201,7 +172,7 @@ jobs: # cache-to: type=gha,mode=max sbom: true outputs: | - ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' && format('type=image,"name={0}",push-by-digest=true,name-canonical=true,push=true', needs.define-variables.outputs.images_list) || format('type=image,"name={0}",push=false', needs.define-variables.outputs.images_list) }} + ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' && format('type=image,"name={0}",push-by-digest=true,name-canonical=true,push=true', env.IMAGE_PATH) || format('type=image,"name={0}",push=false', env.IMAGE_PATH) }} type=local,dest=/tmp/binaries env: SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }} @@ -217,7 +188,7 @@ jobs: merge-maxperf: name: "Create Max-Perf Manifest" runs-on: dind - needs: [define-variables, build-maxperf] + needs: build-maxperf steps: - name: Checkout repository uses: actions/checkout@v5 @@ -228,6 +199,6 @@ jobs: with: digest_pattern: "digests-maxperf-linux-{amd64-haswell,arm64}" tag_suffix: "-maxperf" - images: ${{ needs.define-variables.outputs.images }} + images: ${{ env.IMAGE_PATH }} registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }} registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}