-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f581371
commit 7d8e3f7
Showing
5 changed files
with
6 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
# ratherthan 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,31 +59,26 @@ 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.app_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.3.4 | ||
with: | ||
branch: ${{ inputs.languages_cli_branch }} | ||
|
||
- name: Bump versions and update changelogs | ||
id: prepare | ||
run: | | ||
actions prepare-release \ | ||
--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/[email protected] | ||
|
@@ -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 }}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
# ratherthan 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,19 +66,14 @@ jobs: | |
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Install musl-tools | ||
run: sudo apt-get install musl-tools --no-install-recommends | ||
|
||
- name: Update Rust toolchain | ||
run: rustup update | ||
|
||
- name: Install Rust linux-musl target | ||
run: rustup target add x86_64-unknown-linux-musl | ||
|
||
- name: Rust cache | ||
uses: Swatinem/[email protected] | ||
|
||
# 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 | ||
|
@@ -93,25 +84,20 @@ jobs: | |
| yq -ptoml -oyaml '.package[] | select(.name == "libcnb-package") | .version' \ | ||
) | ||
cargo install --locked "libcnb-cargo@${LIBCNB_PACKAGE_VERSION}" | ||
- 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.3.4 | ||
with: | ||
branch: ${{ inputs.languages_cli_branch }} | ||
update_rust_toolchain: false | ||
|
||
- name: Package buildpacks | ||
id: libcnb-package | ||
run: cargo libcnb package --release --package-dir ${{ env.PACKAGE_DIR }} | ||
|
||
- name: Generate buildpack matrix | ||
id: generate-buildpack-matrix | ||
run: actions generate-buildpack-matrix --package-dir ${{ env.PACKAGE_DIR }} | ||
|
||
- name: Generate changelog | ||
id: generate-changelog | ||
run: actions generate-changelog --version ${{ steps.generate-buildpack-matrix.outputs.version }} | ||
|
||
- name: Temporary fix for bash-based buildpacks | ||
run: | | ||
buildpacks='${{ steps.generate-buildpack-matrix.outputs.buildpacks }}' | ||
|
@@ -149,13 +135,11 @@ jobs: | |
fi | ||
done | ||
done | ||
- name: Cache buildpacks | ||
uses: actions/cache/save@v3 | ||
with: | ||
key: ${{ github.run_id }}-compiled-buildpacks | ||
path: ${{ env.PACKAGE_DIR }} | ||
|
||
publish-docker: | ||
name: Publish → Docker - ${{ matrix.buildpack_id }} | ||
needs: [compile] | ||
|
@@ -173,31 +157,25 @@ jobs: | |
path: ${{ env.PACKAGE_DIR }} | ||
env: | ||
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 | ||
|
||
- name: Install Pack CLI | ||
uses: buildpacks/github-actions/[email protected] | ||
|
||
- name: Create Docker Image | ||
run: pack buildpack package ${{ matrix.buildpack_id }} --config ${{ matrix.buildpack_output_dir }}/package.toml -v | ||
|
||
- name: Login to Docker Hub | ||
if: inputs.dry_run == false | ||
uses: docker/[email protected] | ||
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.docker_repository }}:${{ matrix.buildpack_version }}" &> /dev/null && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT | ||
|
||
- name: Tag and publish buildpack | ||
if: inputs.dry_run == false && steps.check.outputs.published_to_docker == 'false' | ||
run: | | ||
docker tag ${{ matrix.buildpack_id }} ${{ matrix.docker_repository }}:${{ matrix.buildpack_version }} | ||
docker push ${{ matrix.docker_repository }}:${{ matrix.buildpack_version }} | ||
publish-github: | ||
name: Publish → GitHub Release | ||
needs: [compile] | ||
|
@@ -211,31 +189,26 @@ jobs: | |
path: ${{ env.PACKAGE_DIR }} | ||
env: | ||
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 | ||
|
||
- name: Install Pack CLI | ||
uses: buildpacks/github-actions/[email protected] | ||
|
||
- name: Generate CNB files | ||
run: | | ||
for buildpack in $(jq --exit-status -c '.[]' <<< '${{ needs.compile.outputs.buildpacks }}'); do | ||
artifact_prefix=$(jq --exit-status -r '.buildpack_artifact_prefix' <<< "${buildpack}") | ||
output_dir=$(jq --exit-status -r '.buildpack_output_dir' <<< "${buildpack}") | ||
pack buildpack package "${artifact_prefix}.cnb" --config "${output_dir}/package.toml" --format file --verbose | ||
done | ||
- name: Get token for GitHub application (Linguist) | ||
uses: heroku/use-app-token-action@main | ||
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.app_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/[email protected] | ||
|
@@ -245,7 +218,6 @@ jobs: | |
body: ${{ needs.compile.outputs.changelog }} | ||
files: "*.cnb" | ||
fail_on_unmatched_files: true | ||
|
||
publish-cnb: | ||
name: Publish → CNB Registry - ${{ matrix.buildpack_id }} | ||
needs: [compile, publish-docker] | ||
|
@@ -257,7 +229,6 @@ jobs: | |
steps: | ||
- name: Install crane | ||
uses: buildpacks/github-actions/[email protected] | ||
|
||
- name: Check if version is already in the registry | ||
id: check | ||
run: | | ||
|
@@ -267,11 +238,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.docker_repository }}:${{ matrix.buildpack_version }})" >> "$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.4.0 | ||
|
@@ -280,7 +249,6 @@ jobs: | |
id: ${{ matrix.buildpack_id }} | ||
version: ${{ matrix.buildpack_version }} | ||
address: ${{ matrix.docker_repository }}@${{ steps.digest.outputs.value }} | ||
|
||
update-builder: | ||
name: Update Builder | ||
needs: [compile, publish-docker, publish-cnb, publish-github] | ||
|
@@ -292,12 +260,10 @@ jobs: | |
with: | ||
app_id: ${{ inputs.app_id }} | ||
private_key: ${{ secrets.app_private_key }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ./buildpacks | ||
|
||
- name: Checkout cnb-builder-images repository | ||
uses: actions/checkout@v4 | ||
with: | ||
|
@@ -306,22 +272,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.app_token }} | ||
|
||
- name: Install crane | ||
uses: buildpacks/github-actions/[email protected] | ||
|
||
- 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.3.4 | ||
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,buildpacks-20,salesforce-functions | ||
|
||
- name: Create Pull Request | ||
id: pr | ||
uses: peter-evans/[email protected] | ||
|
@@ -339,7 +301,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 }}" | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters