diff --git a/.github/actions/install-languages-cli/action.yml b/.github/actions/install-languages-cli/action.yml index b49a03bf..ae5e3f53 100644 --- a/.github/actions/install-languages-cli/action.yml +++ b/.github/actions/install-languages-cli/action.yml @@ -1,6 +1,5 @@ name: Install Languages CLI description: Downloads the Languages CLI from a known release or installs using Cargo - inputs: branch: # This input is currently the only way we can modify which branch to install the CLI tooling from. Ideally we @@ -13,12 +12,11 @@ inputs: download_url: required: false description: The url to download the CLI binary from - default: "" + default: "https://github.com/heroku/languages-github-actions/releases/download/v0.8.9/actions.tar.gz" update_rust_toolchain: required: false description: Should we run `rustup update` as part of this composite action? default: "true" - runs: using: composite steps: @@ -26,12 +24,10 @@ runs: shell: bash if: inputs.update_rust_toolchain == 'true' && inputs.download_url == '' run: rustup update - - name: Build actions binary shell: bash if: inputs.download_url == '' run: cargo install --locked --git https://github.com/heroku/languages-github-actions.git --branch ${{ inputs.branch }} - - name: Download actions binary shell: bash if: inputs.download_url != '' diff --git a/.github/workflows/_buildpacks-prepare-release.yml b/.github/workflows/_buildpacks-prepare-release.yml index bbeda2ca..1c87aaf5 100644 --- a/.github/workflows/_buildpacks-prepare-release.yml +++ b/.github/workflows/_buildpacks-prepare-release.yml @@ -1,5 +1,4 @@ name: _buildpacks-prepare-release - on: workflow_call: inputs: @@ -41,17 +40,14 @@ on: app_private_key: description: Private key of GitHub application (Linguist) required: true - defaults: run: # Setting an explicit bash shell ensures GitHub Actions enables pipefail mode too, # rather than only error on exit (improving failure UX when pipes are used). See: # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell shell: bash - env: CARGO_TERM_COLOR: always - jobs: prepare-release: name: Prepare Release @@ -63,19 +59,16 @@ jobs: with: app-id: ${{ inputs.app_id }} private-key: ${{ secrets.app_private_key }} - - name: Checkout uses: actions/checkout@v4 with: # Using the GH application token here will configure the local git config for this repo with credentials # that can be used to make signed commits that are attributed to the GH application user token: ${{ steps.generate-token.outputs.token }} - - name: Install Languages CLI - uses: heroku/languages-github-actions/.github/actions/install-languages-cli@main + uses: heroku/languages-github-actions/.github/actions/install-languages-cli@v0.8.9 with: branch: ${{ inputs.languages_cli_branch }} - - name: Bump versions and update changelogs id: prepare run: | @@ -83,11 +76,9 @@ jobs: --bump ${{ inputs.bump }} \ --repository-url https://github.com/${{ github.repository }} \ ${{ inputs.declarations_starting_version && format('--declarations-starting-version {0}', inputs.declarations_starting_version) }} - - name: Generate changelog id: generate-changelog run: actions generate-changelog --version ${{ steps.prepare.outputs.to_version }} - - name: Create pull request id: pr uses: peter-evans/create-pull-request@v7.0.5 @@ -104,7 +95,6 @@ jobs: # This will ensure commits made from this workflow are attributed to the GH application user committer: ${{ inputs.app_username }} <${{ inputs.app_email }}> author: ${{ inputs.app_username }} <${{ inputs.app_email }}> - - name: Configure pull request if: steps.pr.outputs.pull-request-operation == 'created' run: gh pr merge --auto --squash "${{ steps.pr.outputs.pull-request-number }}" diff --git a/.github/workflows/_buildpacks-release.yml b/.github/workflows/_buildpacks-release.yml index cd43fa2a..3a73ec6a 100644 --- a/.github/workflows/_buildpacks-release.yml +++ b/.github/workflows/_buildpacks-release.yml @@ -1,5 +1,4 @@ name: _buildpacks-release - on: workflow_call: inputs: @@ -45,18 +44,15 @@ on: docker_hub_token: required: true description: The token to login to Docker Hub with - defaults: run: # Setting an explicit bash shell ensures GitHub Actions enables pipefail mode too, # rather than only error on exit (improving failure UX when pipes are used). See: # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell shell: bash - env: CARGO_TERM_COLOR: always PACKAGE_DIR: ./packaged - jobs: compile: name: Compile Buildpacks @@ -70,20 +66,16 @@ jobs: uses: actions/checkout@v4 with: submodules: true - - name: Install Languages CLI - uses: heroku/languages-github-actions/.github/actions/install-languages-cli@main + uses: heroku/languages-github-actions/.github/actions/install-languages-cli@v0.8.9 with: branch: ${{ inputs.languages_cli_branch }} update_rust_toolchain: false - - name: Generate buildpack matrix id: generate-buildpack-matrix run: actions generate-buildpack-matrix --temporary-id "${{ github.run_id }}" --package-dir "${{ env.PACKAGE_DIR }}" - - name: Update Rust toolchain run: rustup update - - name: Install cross-compile tooling env: RUST_TRIPLES: ${{ steps.generate-buildpack-matrix.outputs.rust_triples }} @@ -96,10 +88,8 @@ jobs: fi rustup target add "$triple" done - - name: Rust cache uses: Swatinem/rust-cache@v2.7.5 - # the version of `libcnb-cargo` installed here is kept in sync with the version of `libcnb-package` # that the release automation CLI tooling depends on - name: Install libcnb-cargo @@ -110,7 +100,6 @@ jobs: | yq -ptoml -oyaml '.package[] | select(.name == "libcnb-package") | .version' \ ) cargo install --locked "libcnb-cargo@${LIBCNB_PACKAGE_VERSION}" - - name: Package buildpacks id: libcnb-package env: @@ -134,17 +123,14 @@ jobs: cargo libcnb package --release --package-dir "${package_dir}" --target "${triple}" done done - - name: Generate changelog id: generate-changelog run: actions generate-changelog --version ${{ steps.generate-buildpack-matrix.outputs.version }} - - name: Cache buildpacks uses: actions/cache/save@v4 with: key: ${{ github.run_id }}-compiled-buildpacks path: ${{ env.PACKAGE_DIR }} - publish-docker: name: Publish → Docker - ${{ matrix.buildpack_id }} needs: [compile] @@ -163,7 +149,6 @@ jobs: uses: actions/checkout@v4 with: submodules: true - - name: Restore buildpacks uses: actions/cache/restore@v4 with: @@ -172,24 +157,19 @@ jobs: path: ${{ env.PACKAGE_DIR }} env: SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 - - name: Install Pack CLI uses: buildpacks/github-actions/setup-pack@v5.8.3 - - name: Install Crane uses: buildpacks/github-actions/setup-tools@v5.8.3 - - name: Login to Docker Hub uses: docker/login-action@v3.3.0 with: registry: docker.io username: ${{ secrets.docker_hub_user }} password: ${{ secrets.docker_hub_token }} - - name: Check if version is already on Docker Hub id: check run: echo "published_to_docker=$(docker manifest inspect "${{ matrix.stable_tag }}" &> /dev/null && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT - - name: Publish to temporary tags if: steps.check.outputs.published_to_docker == 'false' env: @@ -225,7 +205,6 @@ jobs: digest=$(crane digest "${{ matrix.temporary_tag }}") echo -e "- \`${{ matrix.temporary_tag }}\`\n - \`${digest}\`" >> $GITHUB_STEP_SUMMARY fi - - name: Promote temporary tags to stable tags if: inputs.dry_run == false && steps.check.outputs.published_to_docker == 'false' env: @@ -242,7 +221,6 @@ jobs: # promote primary image manifest or manifest list to permanent tag crane copy "${{ matrix.temporary_tag }}" "${{ matrix.stable_tag }}" echo "- \`${{ matrix.stable_tag }}\`" >> $GITHUB_STEP_SUMMARY - - name: Unpublish temp tags from this run if: always() env: @@ -272,7 +250,6 @@ jobs: fi done exit $status - publish-github: name: Publish → GitHub Release needs: [compile] @@ -288,7 +265,6 @@ jobs: uses: actions/checkout@v4 with: submodules: true - - name: Restore buildpacks uses: actions/cache/restore@v4 with: @@ -297,10 +273,8 @@ jobs: path: ${{ env.PACKAGE_DIR }} env: SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 - - name: Install Pack CLI uses: buildpacks/github-actions/setup-pack@v5.8.3 - - name: Generate CNB files run: | for buildpack in $(jq --exit-status -c '.[]' <<< '${{ needs.compile.outputs.buildpacks }}'); do @@ -311,20 +285,17 @@ jobs: pack buildpack package "$cnb_file" --target "${oci_target}" --config "${output_dir}/package.toml" --format file --verbose done done - - name: Get token for GitHub application (Linguist) uses: actions/create-github-app-token@v1 id: generate-token with: app-id: ${{ inputs.app_id }} private-key: ${{ secrets.app_private_key }} - - name: Check if release exists id: check env: GH_TOKEN: ${{ steps.generate-token.outputs.token }} run: echo "published_to_github=$(gh release view v${{ needs.compile.outputs.version }} -R ${{ github.repository }} &> /dev/null && echo "true" || echo "false")" >> $GITHUB_OUTPUT - - name: Create GitHub Release if: inputs.dry_run == false && steps.check.outputs.published_to_github == 'false' uses: softprops/action-gh-release@v2.1.0 @@ -334,7 +305,6 @@ jobs: body: ${{ needs.compile.outputs.changelog }} files: "*.cnb" fail_on_unmatched_files: true - publish-cnb-registry: name: Publish → CNB Registry - ${{ matrix.buildpack_id }} needs: [compile, publish-docker] @@ -346,7 +316,6 @@ jobs: steps: - name: Install crane uses: buildpacks/github-actions/setup-tools@v5.8.3 - - name: Check if version is already in the registry id: check run: | @@ -356,11 +325,9 @@ jobs: else echo "published_to_cnb_registry=false" >> $GITHUB_OUTPUT fi - - name: Calculate the buildpack image digest id: digest run: echo "value=$(crane digest ${{ matrix.stable_tag }})" >> "$GITHUB_OUTPUT" - - name: Register the new version with the CNB Buildpack Registry if: inputs.dry_run == false && steps.check.outputs.published_to_cnb_registry == 'false' uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:5.7.4 @@ -369,7 +336,6 @@ jobs: id: ${{ matrix.buildpack_id }} version: ${{ matrix.buildpack_version }} address: ${{ matrix.image_repository }}@${{ steps.digest.outputs.value }} - update-builder: name: Update Builder needs: [compile, publish-docker, publish-cnb-registry, publish-github] @@ -383,12 +349,10 @@ jobs: private-key: ${{ secrets.app_private_key }} owner: heroku repositories: cnb-builder-images - - name: Checkout uses: actions/checkout@v4 with: path: ./buildpacks - - name: Checkout cnb-builder-images repository uses: actions/checkout@v4 with: @@ -397,22 +361,18 @@ jobs: # Using the GH application token here will configure the local git config for this repo with credentials # that can be used to make signed commits that are attributed to the GH application user token: ${{ steps.generate-token.outputs.token }} - - name: Install crane uses: buildpacks/github-actions/setup-tools@v5.8.3 - - name: Install Languages CLI - uses: heroku/languages-github-actions/.github/actions/install-languages-cli@main + uses: heroku/languages-github-actions/.github/actions/install-languages-cli@v0.8.9 with: branch: ${{ inputs.languages_cli_branch }} - - name: Update Builder # The dry run check is performed here because the update process requires a published # image to exist in order to calculate a digest with `crane`. Adding the check here # means no files will be modified and so no PR will be created later. if: inputs.dry_run == false run: actions update-builder --repository-path ./buildpacks --builder-repository-path ./cnb-builder-images --builders builder-20,builder-22,builder-24,salesforce-functions - - name: Create Pull Request id: pr uses: peter-evans/create-pull-request@v7.0.5 @@ -430,7 +390,6 @@ jobs: # This will ensure commits made from this workflow are attributed to the GH application user committer: ${{ inputs.app_username }} <${{ inputs.app_email }}> author: ${{ inputs.app_username }} <${{ inputs.app_email }}> - - name: Configure PR if: steps.pr.outputs.pull-request-operation == 'created' run: gh pr merge --auto --squash --repo heroku/cnb-builder-images "${{ steps.pr.outputs.pull-request-number }}" diff --git a/Cargo.lock b/Cargo.lock index 60ab5afd..5f56ecdd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -289,7 +289,7 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "languages-github-actions" -version = "0.0.0" +version = "0.8.9" dependencies = [ "chrono", "clap", diff --git a/Cargo.toml b/Cargo.toml index 5e1e1912..f66cff82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ rust-version = "1.75" edition = "2021" # This crate isn't published to crates.io, however, we still need the version field here, # since it's updated to the real version as part of tagging/publishing to GitHub releases. -version = "0.0.0" +version = "0.8.9" publish = false [[bin]]