From 13ddd06ac604761b27497208561002985c0cc3e2 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Sun, 12 Jul 2020 20:15:19 +1000 Subject: [PATCH] fix: not really a fix, just testing release notes --- .github/workflows/release_gem.yml | 45 ++++----------------- .github/workflows/release_gem_2.yml | 17 -------- action.yml | 6 --- release-image/entrypoint.sh | 3 -- release-image/release/Gemfile | 5 --- release-image/release/Rakefile | 5 --- release-image/usr/local/bin/prepare-release | 21 ---------- release-image/usr/local/bin/release-gem | 24 ----------- script/api_key_test.rb | 5 --- script/prepare-github-release.sh | 7 ---- script/prepare-release.sh | 12 ------ script/release-gem.sh | 23 ----------- script/trigger-release.sh | 2 - 13 files changed, 8 insertions(+), 167 deletions(-) delete mode 100644 .github/workflows/release_gem_2.yml delete mode 100644 action.yml delete mode 100755 release-image/entrypoint.sh delete mode 100644 release-image/release/Gemfile delete mode 100644 release-image/release/Rakefile delete mode 100755 release-image/usr/local/bin/prepare-release delete mode 100755 release-image/usr/local/bin/release-gem delete mode 100644 script/api_key_test.rb delete mode 100755 script/prepare-github-release.sh delete mode 100755 script/prepare-release.sh delete mode 100755 script/release-gem.sh mode change 100755 => 100644 script/trigger-release.sh diff --git a/.github/workflows/release_gem.yml b/.github/workflows/release_gem.yml index 6a4c736b..7e65ed49 100644 --- a/.github/workflows/release_gem.yml +++ b/.github/workflows/release_gem.yml @@ -1,4 +1,4 @@ -name: Release gem +name: Release gem 2 on: repository_dispatch: @@ -12,41 +12,12 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: actions/setup-ruby@v1 - with: - ruby-version: '2.6' - - name: Install gems - run: | - gem update --system - gem install bundler -v 2.0.2 - bundle install - - name: Configure git - run: | - git config user.email "beth@bethesque.com" - git config user.name "Beth Skurrie via Github Actions" - - name: Prepare release - run: script/prepare-release.sh - env: - INCREMENT: patch - - name: Release gem - run: | - touch ~/.gem/credentials - script/release-gem.sh + - uses: pact-foundation/release-gem@master env: GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_API_KEY }}' - - name: Prepare Github Release - run: script/prepare-github-release.sh - - name: Create Github Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.TAG }} - release_name: ${{ env.TAG }} - body_path: tmp/RELEASE_NOTES.md - - name: Trigger release of pact-cli Docker image - uses: peter-evans/repository-dispatch@v1 - with: - token: ${{ secrets.GHTOKENFORPACTCLIRELEASE }} - repository: pact-foundation/pact-ruby-cli - event-type: gem-released + # - name: Trigger release of pact-cli Docker image + # uses: peter-evans/repository-dispatch@v1 + # with: + # token: ${{ secrets.GHTOKENFORPACTCLIRELEASE }} + # repository: pact-foundation/pact-ruby-cli + # event-type: gem-released diff --git a/.github/workflows/release_gem_2.yml b/.github/workflows/release_gem_2.yml deleted file mode 100644 index 2314794d..00000000 --- a/.github/workflows/release_gem_2.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Release gem 2 - -on: - repository_dispatch: - types: - - release-patch-2 - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: pact-foundation/release-gem@master - env: - GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_API_KEY }}' diff --git a/action.yml b/action.yml deleted file mode 100644 index 12ec05ce..00000000 --- a/action.yml +++ /dev/null @@ -1,6 +0,0 @@ -# action.yml -name: 'Release gem' -description: 'Release gem to rubygems, generate changelog, create release notes' -runs: - using: 'docker' - image: 'Dockerfile' diff --git a/release-image/entrypoint.sh b/release-image/entrypoint.sh deleted file mode 100755 index 0cd42d11..00000000 --- a/release-image/entrypoint.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -echo "Hello" \ No newline at end of file diff --git a/release-image/release/Gemfile b/release-image/release/Gemfile deleted file mode 100644 index f6bd85fe..00000000 --- a/release-image/release/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://rubygems.org' - -gem 'bump', git: 'https://github.com/bethesque/bump.git' -gem 'conventional-changelog', '~>1.3' -gem 'rake', '~>13.0' diff --git a/release-image/release/Rakefile b/release-image/release/Rakefile deleted file mode 100644 index d6d03921..00000000 --- a/release-image/release/Rakefile +++ /dev/null @@ -1,5 +0,0 @@ -require "rake/clean" -CLOBBER.include "pkg" - -require "bundler/gem_helper" -Bundler::GemHelper.install_tasks(dir: File.absolute_path("..")) diff --git a/release-image/usr/local/bin/prepare-release b/release-image/usr/local/bin/prepare-release deleted file mode 100755 index 80df47b9..00000000 --- a/release-image/usr/local/bin/prepare-release +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -echo "::group::Internal logs" -set -ex - -# Because the BUNDLE_GEMFILE is set on the docker image, everything -# runs in the context of the - -increment=${INCREMENT:-patch} -bundle exec bump ${increment} --no-commit -bundle exec ruby -e " -require 'conventional_changelog' -require 'bump' -ConventionalChangelog::Generator.new.generate! version: \"v#{Bump::Bump.current}\" -" -version_file=$(bundle exec bump file --value-only) -version=$(bundle exec bump current --value-only) -git add CHANGELOG.md "${version_file}" -git commit -m "chore(release): version ${version}" - -echo "::endgroup::" diff --git a/release-image/usr/local/bin/release-gem b/release-image/usr/local/bin/release-gem deleted file mode 100755 index 7eaebd60..00000000 --- a/release-image/usr/local/bin/release-gem +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -set -ex - -# Set up .netrc file with GitHub credentials -git_setup() { - cat <<-EOF >$HOME/.netrc - machine github.com - login $GITHUB_ACTOR - password $GITHUB_TOKEN - machine api.github.com - login $GITHUB_ACTOR - password $GITHUB_TOKEN -EOF - chmod 600 $HOME/.netrc -} - -git_setup - -# Overzealous validation stops rake release from running without a credentials file -touch ~/.gem/credentials -mkdir -p tmp -cp /release/Rakefile tmp/Rakefile -cd tmp -bundle exec rake release diff --git a/script/api_key_test.rb b/script/api_key_test.rb deleted file mode 100644 index fcd4f5a5..00000000 --- a/script/api_key_test.rb +++ /dev/null @@ -1,5 +0,0 @@ -puts "env: #{ENV["GEM_HOST_API_KEY"].chars.first}" - -require 'rubygems/commands/push_command' -include Gem::GemcutterUtilities -puts "gemcutter: #{api_key.chars.first}" \ No newline at end of file diff --git a/script/prepare-github-release.sh b/script/prepare-github-release.sh deleted file mode 100755 index d7211123..00000000 --- a/script/prepare-github-release.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -set -e - -tag=$(git describe) -mkdir -p tmp -git diff CHANGELOG.md | grep "^+" | grep -v "b/CHANGELOG.md" | sed 's/^+//g' > tmp/RELEASE_NOTES.md -echo "::set-env name=TAG::${tag}" \ No newline at end of file diff --git a/script/prepare-release.sh b/script/prepare-release.sh deleted file mode 100755 index b035eb99..00000000 --- a/script/prepare-release.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -set -e - -# bundle exec rake -increment=${INCREMENT:-patch} -bundle exec bump ${increment} --no-commit -bundle exec rake generate_changelog -version_file=$(bundle exec bump file --value-only) -version=$(bundle exec bump current --value-only) -git add CHANGELOG.md "${version_file}" -git commit -m "chore(release): version ${version}" - diff --git a/script/release-gem.sh b/script/release-gem.sh deleted file mode 100755 index d4412567..00000000 --- a/script/release-gem.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# if [ -n "${GITHUB_ACTIONS}" ]; then -# : "${RUBYGEMS_API_KEY:?RUBYGEMS_API_KEY must be set}" -# : "${GITHUB_TOKEN:?GITHUB_TOKEN must be set}" - -# echo "Setting up gem credentials..." -# set +x -# mkdir -p ~/.gem - -# cat << EOF > ~/.gem/credentials -# --- -# :github: Bearer ${GITHUB_TOKEN} -# :rubygems_api_key: ${RUBYGEMS_API_KEY} -# EOF - -# chmod 0600 ~/.gem/credentials -# set -x - -# fi - -echo "Running gem release task..." -bundle exec rake release diff --git a/script/trigger-release.sh b/script/trigger-release.sh old mode 100755 new mode 100644 index 241f4538..eb530520 --- a/script/trigger-release.sh +++ b/script/trigger-release.sh @@ -5,8 +5,6 @@ output=$(curl -v -X POST https://api.github.com/repos/pact-foundation/pact_broke -H "Authorization: Bearer $GITHUB_ACCESS_TOKEN" \ -d '{"event_type": "release-patch"}' 2>&1) -echo "$output" | sed "s/${GITHUB_ACCESS_TOKEN}/****/g" - if ! echo "${output}" | grep "HTTP\/1.1 204" > /dev/null; then echo "$output" | sed "s/${GITHUB_ACCESS_TOKEN}/****/g" echo "Failed to do the thing"