Skip to content

Create Release Pull Request #49

Create Release Pull Request

Create Release Pull Request #49

name: Create Release Pull Request
permissions:
contents: read
on:
workflow_dispatch:
inputs:
redo_release_tag:
description: 'Redo a draft release from a recent tag. Should only be used if a draft release PR has been merged'
required: false
git_tag:
description: Git Tag To Release From. Last Git Tag Is Used If Omitted
required: false
branch_name:
description: New Branch To Bump Crates
required: true
ockam_bump_modified_release:
description: Crates That Are To Follow A Different Release Version
required: false
ockam_bump_release_version:
description: Release Version
type: choice
default: minor
options:
- major
- minor
- patch
ockam_bump_bumped_dep_crates_version:
description: Crates That Are Bumped Due To Being Transitive Deps
type: choice
default: minor
options:
- major
- minor
- patch
# runs every command in bash (for every job in the workflow)
defaults:
run:
shell: bash
jobs:
bump_crates:
permissions:
# Contents permission allows us write to this repository.
contents: write
# Pull request write ability
pull-requests: write
name: Bump Crates And Create PR
runs-on: ubuntu-20.04
environment: release
container:
# Note: Do not update this image has it has installed all binaries
# to bump crates and generate changelogs which we don't want installed
# in our CI packages.
image: ghcr.io/build-trust/ockam-builder@sha256:b7790a79e5fd4265d8333bb882010e5d4326778f270bd49693fa35763865df82
steps:
- name: Checkout Ockam
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
fetch-depth: 0
- name: Checkout To New Release Branch
id: commit
run: |
git checkout -B ${{ github.event.inputs.branch_name }}
sha=$(git rev-parse HEAD)
echo "sha=$sha" >> $GITHUB_OUTPUT
- name: Import GPG key
uses: build-trust/.github/actions/import_gpg@a6377d3c2dac878b92a0da26cdf3da2856c64840
with:
gpg_private_key: '${{ secrets.GPG_PRIVATE_KEY }}'
gpg_password: '${{ secrets.GPG_PASSPHRASE }}'
gpg_name: '${{ secrets.GPG_USER_NAME }}'
gpg_email: '${{ secrets.GPG_EMAIL }}'
- name: Redo Release From A Recent Draft PR
if: ${{ inputs.redo_release_tag != '' }}
env:
OCKAM_BUMP_BUMPED_DEP_CRATES_VERSION: ${{ github.event.inputs.ockam_bump_bumped_dep_crates_version }}
GIT_TAG_WE_WILL_BE_UPDATING: ${{ github.event.inputs.redo_release_tag }}
LAST_RELEASED_TAG: ${{ github.event.inputs.git_tag }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
bash -ex ./tools/scripts/release/redo-draft-release.sh
# Delete the old git tag, it'll be recreated when we are creating a new draft binary.
if gh release view ${{ inputs.redo_release_tag }}; then
gh release delete ${{ inputs.redo_release_tag }} --cleanup-tag
fi
- name: Bump Ockam
if: ${{ inputs.redo_release_tag == '' }}
env:
OCKAM_BUMP_RELEASE_VERSION: '${{ github.event.inputs.ockam_bump_release_version }}'
OCKAM_BUMP_MODIFIED_RELEASE: '${{ github.event.inputs.ockam_bump_modified_release }}'
OCKAM_BUMP_BUMPED_DEP_CRATES_VERSION: '${{ github.event.inputs.ockam_bump_bumped_dep_crates_version }}'
GIT_TAG: '${{ github.event.inputs.git_tag }}'
run: bash -ex ./tools/scripts/release/crate-bump.sh
- name: Generate Changelogs
if: ${{ inputs.redo_release_tag == '' }}
env:
GIT_TAG: '${{ github.event.inputs.git_tag }}'
run: bash -ex ./tools/scripts/release/changelog.sh
- name: Update Readme
run: make -f implementations/rust/Makefile update_readmes
- name: Push Update
run: |
# Squash commits
git reset ${{ steps.commit.outputs.sha }}
git add .
git commit -S -m "ci: crate release $(date +'%d-%m-%Y')"
git push --set-upstream origin ${{ github.event.inputs.branch_name }}