Skip to content

Release pact-5 5650ae1a2a941a4e302cb48816c2634edb0bb0aa from a8856bf0ad41ae4b698a2e4e951108bf2bf4f32b #9

Release pact-5 5650ae1a2a941a4e302cb48816c2634edb0bb0aa from a8856bf0ad41ae4b698a2e4e951108bf2bf4f32b

Release pact-5 5650ae1a2a941a4e302cb48816c2634edb0bb0aa from a8856bf0ad41ae4b698a2e4e951108bf2bf4f32b #9

name: Release - manual - pact
## Release automation for pact
run-name: "Release pact-5 ${{ inputs.release_sha }} from ${{ github.sha}}"
on:
workflow_dispatch:
inputs:
release_sha:
description: "full git sha pact release, default to branch running this job"
type: string
required: false
release_version:
description: "The X.Y.Z tag for the new version"
type: string
required: true
draft:
description: "set the new release as a draft instead of published"
type: boolean
required: false
default: true
prerelease:
description: "set to true for nightly builds"
type: boolean
required: false
default: false
workflow_call:
inputs:
release_sha:
description: "full git sha for release, default to branch running this job"
type: string
required: false
release_version:
description: "The X.Y.Z tag for the new version"
type: string
required: false
default: "nightly"
draft:
description: "set the new release as a draft instead of published"
type: boolean
required: false
default: false
prerelease:
description: "set to true for nightly builds"
type: boolean
required: false
default: true
jobs:
release_vars:
runs-on: ubuntu-latest
outputs:
RELEASE_SHA: ${{ steps.set-vars.outputs.RELEASE_SHA }}
SHORT_REVISION: ${{ steps.set-vars.outputs.SHORT_REVISION }}
RELEASE_VERSION: ${{ steps.set-vars.outputs.RELEASE_VERSION }}
IMAGE: ${{ steps.set-vars.outputs.IMAGE }}
GHC_VERSION: ${{ steps.set-ghc-version.outputs.GHC_VERSION }}
steps:
# if this plugin is bad we just override it
# - name: Bump version and push tag
# id: tag_version
# uses: mathieudutour/[email protected]
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# default_bump: ${{ inputs.tag_default_bump }}
# tag_prefix: ""
# commit_sha: ${{ inputs.release_sha }}
- name: Set variables for release
id: set-vars
run: |
RELEASE_SHA=${{ github.sha }}
if [[ ! -z "${{ inputs.release_sha }}" ]]; then
RELEASE_SHA=${{ inputs.release_sha }}
fi
echo "RELEASE_SHA=$RELEASE_SHA" >> $GITHUB_OUTPUT
SHORT_REVISION=$(echo $RELEASE_SHA | cut -c 1-7)
echo "SHORT_REVISION=$SHORT_REVISION" >> $GITHUB_OUTPUT
echo "RELEASE_VERSION=${{ inputs.release_version }}" >> $GITHUB_OUTPUT
echo "IMAGE=ghcr.io/kadena-io/pact-5:sha-$SHORT_REVISION" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
with:
ref: ${{ steps.set-vars.outputs.RELEASE_SHA }}
sparse-checkout: |
.github/workflows/applications.yml
- name: Get ghc version
id: set-ghc-version
run: |
VERSION=$(grep -Po '(?<=ghc: \[")(\d\.\d)(\.\d)+' .github/workflows/applications.yml | head -1)
if [[ -z $VERSION ]]; then
echo "Unable to get pact version from applications.yml"
exit 1
fi
echo "GHC_VERSION=$VERSION" >> $GITHUB_OUTPUT
release_to_github:
runs-on: ubuntu-latest
needs: release_vars
env:
RELEASE_SHA: ${{ needs.release_vars.outputs.RELEASE_SHA }}
RELEASE_VERSION: ${{ needs.release_vars.outputs.RELEASE_VERSION }}
GHC_VERSION: ${{ needs.release_vars.outputs.GHC_VERSION }}
IMAGE: ${{ needs.release_vars.outputs.IMAGE }}
outputs:
OSX_RELEASE_URL: ${{ steps.release-artifact-download.outputs.MACOS_RELEASE_URL }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ steps.set-vars.outputs.RELEASE_SHA }}
sparse-checkout: |
CHANGELOG.md
- name: Get release artifacts
id: release-artifact-download
run: |
pwd
UBUNTU_TAR=pact.${{ env.GHC_VERSION }}.ubuntu-22.04.${{ env.RELEASE_SHA }}.tar.gz
MACOS_TAR=pact.${{ env.GHC_VERSION }}.macos-14.${{ env.RELEASE_SHA }}.tar.gz
UBUNTU_RELEASE_FILE=pact-${{ env.RELEASE_VERSION }}-linux-x64.tar.gz
MACOS_RELEASE_FILE=pact-${{ env.RELEASE_VERSION }}-darwin-aarch64.tar.gz
curl "s3.us-east-1.amazonaws.com/kadena-cabal-cache/pact/$UBUNTU_TAR" -o "./$UBUNTU_RELEASE_FILE"
curl "s3.us-east-1.amazonaws.com/kadena-cabal-cache/pact/$MACOS_TAR" -o "./$MACOS_RELEASE_FILE"
echo "UBUNTU_RELEASE_FILE=$UBUNTU_RELEASE_FILE" >> $GITHUB_ENV
echo "MACOS_RELEASE_FILE=$MACOS_RELEASE_FILE" >> $GITHUB_ENV
if [[ "$RELEASE_VERSION" != "nightly" ]]; then
echo "MACOS_RELEASE_URL=https://github.com/kadena-io/pact-5/releases/download/${{ env.RELEASE_VERSION }}/$MACOS_RELEASE_FILE" >> $GITHUB_OUTPUT
else
echo "MACOS_RELEASE_URL='' >> $GITHUB_OUTPUT"
fi
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: retag ghcr docker images
continue-on-error: false
run: |
docker pull $IMAGE
docker run --rm $IMAGE --version
docker tag $IMAGE ghcr.io/kadena-io/pact-5:$RELEASE_VERSION
if [[ "$RELEASE_VERSION" != "nightly" ]]; then
docker tag $IMAGE ghcr.io/kadena-io/pact-5:latest
else
docker tag $IMAGE ghcr.io/kadena-io/pact-5:nightly
fi
docker image push --all-tags ghcr.io/kadena-io/pact-5
- name: Generate release
uses: ncipollo/release-action@v1
#if: startsWith(github.ref, 'refs/tags/')
with:
bodyFile: CHANGELOG.md
artifacts: "${{ env.UBUNTU_RELEASE_FILE }},${{ env.MACOS_RELEASE_FILE }}"
commit: ${{ env.RELEASE_SHA }}
name: ${{ env.RELEASE_VERSION }}
tag: ${{ env.RELEASE_VERSION }}
omitBodyDuringUpdate: true
skipIfReleaseExists: false
draft: ${{ inputs.draft }}
prerelease: ${{ inputs.prerelease }}
generateReleaseNotes: true
allowUpdates: true
replacesArtifacts: true
updateOnlyUnreleased: true
release_to_brew:
uses: kadena-io/homebrew-pact/.github/workflows/release-bump.yml@master
needs: release_to_github
with:
pact_arm: "${{ needs.release_to_github.outputs.OSX_RELEASE_URL }}"
pact_head: https://github.com/kadena-io/pact-5/releases/download/nightly/pact-nightly-darwin-aarch64.tar.gz
secrets: inherit