Skip to content

Commit

Permalink
Publish beta version
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonydahanne authored Apr 1, 2024
1 parent 2df5cbf commit a69519a
Showing 1 changed file with 64 additions and 66 deletions.
130 changes: 64 additions & 66 deletions .github/workflows/pb-create-package.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Create Package
"on":
release:
types:
- published
push:
branches: "dualarch"

jobs:
create-package:
name: Create Package
Expand Down Expand Up @@ -71,37 +71,37 @@ jobs:
${{ env.HOME }}/.pack
${{ env.HOME }}/carton-cache
restore-keys: ${{ runner.os }}-go-
- name: Compute Version
id: version
run: |
#!/usr/bin/env bash
set -euo pipefail
if [[ ${GITHUB_REF:-} != "refs/"* ]]; then
echo "GITHUB_REF set to [${GITHUB_REF:-}], but that is unexpected. It should start with 'refs/*'"
exit 255
fi
if [[ ${GITHUB_REF} =~ refs/tags/v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
MAJOR_VERSION="$(echo "${VERSION}" | awk -F '.' '{print $1 }')"
MINOR_VERSION="$(echo "${VERSION}" | awk -F '.' '{print $1 "." $2 }')"
echo "version-major=${MAJOR_VERSION}" >> "$GITHUB_OUTPUT"
echo "version-minor=${MINOR_VERSION}" >> "$GITHUB_OUTPUT"
elif [[ ${GITHUB_REF} =~ refs/heads/(.+) ]]; then
VERSION=${BASH_REMATCH[1]}
else
VERSION=$(git rev-parse --short HEAD)
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Selected ${VERSION} from
* ref: ${GITHUB_REF}
* sha: ${GITHUB_SHA}
"
# - name: Compute Version
# id: version
# run: |
# #!/usr/bin/env bash

# set -euo pipefail

# if [[ ${GITHUB_REF:-} != "refs/"* ]]; then
# echo "GITHUB_REF set to [${GITHUB_REF:-}], but that is unexpected. It should start with 'refs/*'"
# exit 255
# fi

# if [[ ${GITHUB_REF} =~ refs/tags/v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
# VERSION=${BASH_REMATCH[1]}

# MAJOR_VERSION="$(echo "${VERSION}" | awk -F '.' '{print $1 }')"
# MINOR_VERSION="$(echo "${VERSION}" | awk -F '.' '{print $1 "." $2 }')"

# echo "version-major=${MAJOR_VERSION}" >> "$GITHUB_OUTPUT"
# echo "version-minor=${MINOR_VERSION}" >> "$GITHUB_OUTPUT"
# elif [[ ${GITHUB_REF} =~ refs/heads/(.+) ]]; then
# VERSION=${BASH_REMATCH[1]}
# else
# VERSION=$(git rev-parse --short HEAD)
# fi

# echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
# echo "Selected ${VERSION} from
# * ref: ${GITHUB_REF}
# * sha: ${GITHUB_SHA}
# "
- name: Create Package
run: |
#!/usr/bin/env bash
Expand Down Expand Up @@ -193,35 +193,33 @@ jobs:
env:
PACKAGES: docker.io/paketobuildpacks/java-native-image gcr.io/paketo-buildpacks/java-native-image
PUBLISH: "true"
VERSION: ${{ steps.version.outputs.version }}
VERSION_MAJOR: ${{ steps.version.outputs.version-major }}
VERSION_MINOR: ${{ steps.version.outputs.version-minor }}
- name: Update release with digest
run: |
#!/usr/bin/env bash
set -euo pipefail
PAYLOAD=$(cat "${GITHUB_EVENT_PATH}")
RELEASE_ID=$(jq -n -r --argjson PAYLOAD "${PAYLOAD}" '$PAYLOAD.release.id')
RELEASE_TAG_NAME=$(jq -n -r --argjson PAYLOAD "${PAYLOAD}" '$PAYLOAD.release.tag_name')
RELEASE_NAME=$(jq -n -r --argjson PAYLOAD "${PAYLOAD}" '$PAYLOAD.release.name')
RELEASE_BODY=$(jq -n -r --argjson PAYLOAD "${PAYLOAD}" '$PAYLOAD.release.body')
gh api \
--method PATCH \
"/repos/:owner/:repo/releases/${RELEASE_ID}" \
--field "tag_name=${RELEASE_TAG_NAME}" \
--field "name=${RELEASE_NAME}" \
--field "body=${RELEASE_BODY//<!-- DIGEST PLACEHOLDER -->/\`${DIGEST}\`}"
env:
DIGEST: ${{ steps.package.outputs.digest }}
GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
- if: ${{ true }}
uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:5.5.3
with:
address: docker.io/paketobuildpacks/java-native-image@${{ steps.package.outputs.digest }}
id: paketo-buildpacks/java-native-image
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
version: ${{ steps.version.outputs.version }}
VERSION: "beta"
# - name: Update release with digest
# run: |
# #!/usr/bin/env bash

# set -euo pipefail

# PAYLOAD=$(cat "${GITHUB_EVENT_PATH}")

# RELEASE_ID=$(jq -n -r --argjson PAYLOAD "${PAYLOAD}" '$PAYLOAD.release.id')
# RELEASE_TAG_NAME=$(jq -n -r --argjson PAYLOAD "${PAYLOAD}" '$PAYLOAD.release.tag_name')
# RELEASE_NAME=$(jq -n -r --argjson PAYLOAD "${PAYLOAD}" '$PAYLOAD.release.name')
# RELEASE_BODY=$(jq -n -r --argjson PAYLOAD "${PAYLOAD}" '$PAYLOAD.release.body')

# gh api \
# --method PATCH \
# "/repos/:owner/:repo/releases/${RELEASE_ID}" \
# --field "tag_name=${RELEASE_TAG_NAME}" \
# --field "name=${RELEASE_NAME}" \
# --field "body=${RELEASE_BODY//<!-- DIGEST PLACEHOLDER -->/\`${DIGEST}\`}"
# env:
# DIGEST: ${{ steps.package.outputs.digest }}
# GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
# - if: ${{ true }}
# uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:5.5.3
# with:
# address: docker.io/paketobuildpacks/java-native-image@${{ steps.package.outputs.digest }}
# id: paketo-buildpacks/java-native-image
# token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
# version: ${{ steps.version.outputs.version }}

0 comments on commit a69519a

Please sign in to comment.