Skip to content

Commit

Permalink
Release v0.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
heroku-linguist[bot] committed Oct 11, 2023
1 parent f581371 commit 7d8e3f7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 59 deletions.
6 changes: 1 addition & 5 deletions .github/actions/install-languages-cli/action.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -13,25 +12,22 @@ 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.3.4/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:
- name: Update Rust toolchain
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 != ''
Expand Down
12 changes: 1 addition & 11 deletions .github/workflows/_buildpacks-prepare-release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: _buildpacks-prepare-release

on:
workflow_call:
inputs:
Expand Down Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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 }}"
Expand Down
43 changes: 2 additions & 41 deletions .github/workflows/_buildpacks-release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: _buildpacks-release

on:
workflow_call:
inputs:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 }}'
Expand Down Expand Up @@ -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]
Expand All @@ -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]
Expand All @@ -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]
Expand All @@ -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]
Expand All @@ -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: |
Expand All @@ -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
Expand All @@ -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]
Expand All @@ -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:
Expand All @@ -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]
Expand All @@ -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 }}"
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "languages-github-actions"
description = "GitHub Actions for the Languages Team"
version = "0.0.1"
version = "0.3.4"
repository = "https://github.com/heroku/languages-github-actions.git"
rust-version = "1.66"
edition = "2021"
Expand Down

0 comments on commit 7d8e3f7

Please sign in to comment.