First commit #1
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
name: Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
register: | |
name: Package, Publish, and Register | |
runs-on: | |
- ubuntu-latest | |
steps: | |
- id: checkout | |
uses: actions/checkout@v3 | |
- if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} | |
uses: docker/login-action@v1 | |
with: | |
registry: docker.io | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_PASS }} | |
- id: setup-tools | |
uses: buildpacks/github-actions/setup-tools@v5.1.0 | |
- id: setup-pack | |
uses: buildpacks/github-actions/setup-pack@v5.1.0 | |
- id: package | |
run: | | |
#!/usr/bin/env bash | |
set -euo pipefail | |
BP_ID="$(cat buildpack.toml | yj -t | jq -r .buildpack.id)" | |
VERSION="$(cat buildpack.toml | yj -t | jq -r .buildpack.version)" | |
PACKAGE="${REPO}/$(echo "$BP_ID" | sed 's/\//_/g')" | |
pack buildpack package --publish ${PACKAGE}:${VERSION} | |
DIGEST="$(crane digest ${PACKAGE}:${VERSION})" | |
echo "bp_id=$BP_ID" >> "$GITHUB_OUTPUT" | |
echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
echo "address=${PACKAGE}@${DIGEST}" >> "$GITHUB_OUTPUT" | |
shell: bash | |
env: | |
REPO: docker.io/${{ secrets.DOCKER_HUB_USER }} | |
- id: register | |
uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:5.1.0 | |
with: | |
token: ${{ secrets.PUBLIC_REPO_TOKEN }} | |
id: ${{ steps.package.outputs.bp_id }} | |
version: ${{ steps.package.outputs.version }} | |
address: ${{ steps.package.outputs.address }} |