-
-
Notifications
You must be signed in to change notification settings - Fork 563
119 lines (106 loc) · 4.19 KB
/
release-bump-pull-request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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 }}