-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "chore: update release workflow to use new versioning scheme"
This reverts commit e2736e6.
- Loading branch information
Showing
16 changed files
with
221 additions
and
198 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Release Docker image with updated packaging | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release: | ||
description: Release number | ||
required: true | ||
type: number | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: ruby/setup-ruby@v1 | ||
|
||
- name: Prepare release | ||
id: prepare-release | ||
run: script/workflows/prepare-release.sh | ||
env: | ||
RELEASE: ${{ inputs.release }} | ||
|
||
- name: Commit and push version and changelog | ||
uses: EndBug/add-and-commit@v4 | ||
with: | ||
add: CHANGELOG.md | ||
author_name: Beth Skurrie via Github Action | ||
author_email: [email protected] | ||
message: 'chore(release): version ${{ steps.prepare-release.outputs.tag }}' | ||
tag: '${{ steps.prepare-release.outputs.tag }}' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# TODO abort if there are no changes to the Gemfile. | ||
|
||
name: Update gems and prepare to release Docker image | ||
|
||
on: | ||
repository_dispatch: | ||
types: | ||
- gem-released-disabled | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: ruby/setup-ruby@v1 | ||
|
||
- id: update | ||
run: script/workflows/update.sh | ||
env: | ||
RELEASED_GEM_NAME: ${{ github.event.client_payload.name }} | ||
RELEASED_GEM_VERSION: ${{ github.event.client_payload.version }} | ||
|
||
- name: Commit and push gem file changes | ||
uses: EndBug/add-and-commit@v4 | ||
with: | ||
add: Gemfile.lock | ||
author_name: Beth Skurrie via Github Action | ||
author_email: [email protected] | ||
message: 'feat(gems): ${{ steps.update.outputs.commit_message }}' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- id: prepare-release | ||
name: Update version and generate changelog | ||
run: script/workflows/prepare-release.sh | ||
env: | ||
INCREMENT: ${{ github.event.client_payload.increment }} | ||
|
||
- name: Commit and push version and changelog | ||
uses: EndBug/add-and-commit@v4 | ||
with: | ||
add: lib/pact/cli/version.rb Gemfile.lock CHANGELOG.md | ||
author_name: Beth Skurrie via Github Action | ||
author_email: [email protected] | ||
message: 'chore(release): version ${{ steps.prepare-release.outputs.tag }}' | ||
tag: '${{ steps.prepare-release.outputs.tag }}' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# TODO abort if there are no changes to the Gemfile. | ||
|
||
name: Update gems | ||
|
||
on: | ||
repository_dispatch: | ||
types: | ||
- gem-released | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: ruby/setup-ruby@v1 | ||
|
||
- id: update | ||
run: script/workflows/update.sh | ||
env: | ||
RELEASED_GEM_NAME: ${{ github.event.client_payload.name }} | ||
RELEASED_GEM_VERSION: ${{ github.event.client_payload.version }} | ||
|
||
- name: Commit and push gem file changes | ||
uses: EndBug/add-and-commit@v4 | ||
with: | ||
add: Gemfile.lock | ||
author_name: Beth Skurrie via Github Action | ||
author_email: [email protected] | ||
message: 'feat(gems): ${{ steps.update.outputs.commit_message }}' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Trigger release | ||
uses: peter-evans/repository-dispatch@v1 | ||
with: | ||
token: ${{ secrets.GHTOKENFORPACTCLIRELEASE }} | ||
event-type: release-triggered |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,5 @@ | ||
# Releasing | ||
|
||
When one of the Pact gems is released, it sends a repository dispatch notification with event type `gem-released`, which triggers the `Update gems` Github Action that updates the gems and commits the changes. The `Release` workflow is then triggered by another repository dispatch action of type `release-triggered` which generates the release notes, builds and publishes the Docker image, and creates the git commits and tags. | ||
Manual releases are not generally necessary. When one of the Pact gems is released, it sends a repository dispatch notification with event type `gem-released`, which triggers the `Update gems` Github Action that updates the gems and commits the changes. The `Release` workflow is then triggered by another repository dispatch action of type `release-triggered` which generates the release notes, builds and publishes the Docker image, and creates the git commits and tags. | ||
|
||
If the packaging code needs to be updated, a manual release can be performed by running the `Release Docker image with updated packaging` workflow from the UI. | ||
|
||
# Releasing | ||
|
||
Please read the [versioning](/#versioning) section of the README file before continuing. | ||
|
||
The semantic version part of the tag is stored in the `VERSION` file at the root of the repository. | ||
|
||
> Manual releases are not generally necessary. | ||
## Automatic releases of the Docker image triggered by the release of one of the Pact gem | ||
|
||
When one of the Pact gems is released by the Github Action in its repository, the `repository_dispatch` action of the `pact-ruby-cli` repository will be invoked with the type `gem-released`, and the release details (name, version, increment). | ||
|
||
This causes the `update_gems.yml` workflow to be run. At the end of the workflow, it will trigger a release by invoking the `repository_dispatch` action with type `release-triggered`, passing in the increment. | ||
|
||
Note: sometimes bundler cannot find the newly released gem straight away, and the job needs to be re-run via the UI. | ||
|
||
### Manual releases of the Docker image triggered by the release of one of the Pact gem | ||
|
||
* On the Github Actions page, select `Update gems` | ||
* Select `Run workflow` | ||
* To attempt to update a particular gem - update the default `released_gem_name` & set the required `released_gem_version` and then click `Run workflow`. This should be the normal process if a Pact gem has been updated. | ||
* To release a non-minor version change, select the `released_gem_version_increment` you want along with the above values, and click `Run workflow`. | ||
* If the `Gemfile.lock` is updated, the results will be committed back to the repository, along with an updated `lib/pact/cli/version.rb` set to the `released_gem_version_increment` (which defaults to minor) | ||
* This will trigger an automated release of the Docker image, where the Docker semver tag will be updated by a the same `released_gem_version_increment` | ||
|
||
|
||
## Manually releasing the Docker image | ||
|
||
* On the Github Actions page, select `Release Docker image` | ||
* Select `Run workflow` | ||
* To release a minor version change, do not set any inputs - just click `Run workflow`. This should be the normal process if you've done some changes to the Docker image. | ||
* To release a non-minor version change, select the increment you want, and click `Run workflow`. | ||
* To set a custom version number (not sure of the usecase for this, but just in case...), set both the version AND the increment and click `Run workflow`. | ||
* To do a completely custom tag, just set the "Custom Docker image tag" and click `Run workflow`. If you do this, the VERSION file will NOT be updated. It is for testing purposes only. |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
gem_version_from_gemfile_lock() { | ||
grep "pact_broker (" pact_broker/Gemfile.lock | awk -F '[()]' '{print $2}' | ||
} | ||
|
||
gem_version=$(ruby -I lib -e "require 'pact/cli/version.rb'; puts Pact::Cli::VERSION") | ||
existing_tags=$(git tag) | ||
existing_release_numbers_for_current_gem_version=$(echo "$existing_tags" | grep "${gem_version}\." | sed 's/'${gem_version}'\.//g' | grep -E "^[0-9]+$" | cat) | ||
|
||
if [ -n "${existing_release_numbers_for_current_gem_version}" ]; then | ||
last_release_number=$(printf "0\n${existing_release_numbers_for_current_gem_version}" | sort -g | tail -1) | ||
next_release_number=$(( $last_release_number + 1 )) | ||
else | ||
next_release_number=0 | ||
fi | ||
|
||
tag="${gem_version}.${next_release_number}" | ||
echo $tag |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,7 @@ | ||
#!/bin/sh | ||
|
||
set -euo >/dev/null | ||
docker_compose_files=$(find . -name "docker-compose*.yml" -not -name "*test*") | ||
|
||
for file in $docker_compose_files; do | ||
cat $file | sed -e "s~image: pactfoundation/pact-cli:.*~image: pactfoundation/pact-cli:${TAG}~g" > dc-tmp | ||
mv dc-tmp $file | ||
done | ||
|
||
bundle exec conventional-changelog version=${TAG} force=true | ||
|
||
if [ -n "$VERSION" ]; then | ||
bundle exec bump set $VERSION --no-commit | ||
git add VERSION | ||
else | ||
echo "Cannot update VERSION file as no VERSION has been specified" | ||
fi | ||
|
||
git add CHANGELOG.md | ||
git add docker-compose* | ||
git commit -m "chore(release): version ${TAG}" |
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.