From 6a476e20795a01063b1a511fc24857b622bcd64c Mon Sep 17 00:00:00 2001 From: Joakim Antman Date: Sat, 10 Aug 2024 14:29:23 +0300 Subject: [PATCH] Automate release process --- .github/pull_request_template.md | 18 ++++++++++++++ .github/release-please.yml | 2 ++ .github/workflows/gem-push.yml | 42 ++++++++++++++++++++++++++++++++ .github/workflows/pr-title.yml | 15 ++++++++++++ Gemfile | 6 ++--- 5 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 .github/pull_request_template.md create mode 100644 .github/release-please.yml create mode 100644 .github/workflows/gem-push.yml create mode 100644 .github/workflows/pr-title.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..e9bce94 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,18 @@ + + + +### Description + +This Pull Request changes/fixes/enhances this thing... + +### Checklist + +Before the PR can be merged be sure the following are checked: +* [ ] There are tests for the fix or feature added/changed \ No newline at end of file diff --git a/.github/release-please.yml b/.github/release-please.yml new file mode 100644 index 0000000..19c4910 --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1,2 @@ +handleGHRelease: true +manifest: true diff --git a/.github/workflows/gem-push.yml b/.github/workflows/gem-push.yml new file mode 100644 index 0000000..85e82da --- /dev/null +++ b/.github/workflows/gem-push.yml @@ -0,0 +1,42 @@ +--- + on: + push: + tags: + - v*.*.* + + name: Build and push gem + jobs: + push: + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + steps: + - uses: rubygems/configure-rubygems-credentials@main + with: + role-to-assume: rg_oidc_akr_mrgtcg38wgdnv4n9vvyj + - uses: actions/checkout@v4 + - name: Set remote URL + run: | + # Attribute commits to the last committer on HEAD + git config --global user.email "$(git log -1 --pretty=format:'%ae')" + git config --global user.name "$(git log -1 --pretty=format:'%an')" + git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY" + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + ruby-version: ruby + - name: Extract version number + run: echo "GEM_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + - name: Release + run: bundle exec rake release + - name: Wait for release to propagate + run: | + gem install rubygems-await + gem_tuple="$(ruby -rbundler/setup -rbundler -e ' + spec = Bundler.definition.specs.find {|s| s.name == ARGV[0] } + raise "No spec for #{ARGV[0]}" unless spec + print [spec.name, spec.version, spec.platform].join(":") + ' "jwt-eddsa")" + gem await "${gem_tuple}" \ No newline at end of file diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml new file mode 100644 index 0000000..4899031 --- /dev/null +++ b/.github/workflows/pr-title.yml @@ -0,0 +1,15 @@ +name: PR Conventional Commit Validation + +on: + pull_request: + types: [opened, synchronize, reopened, edited] + +jobs: + validate-pr-title: + runs-on: ubuntu-latest + steps: + - name: PR Conventional Commit Validation + uses: ytanikin/PRConventionalCommits@1.2.0 + with: + task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert"]' + add_label: 'false' diff --git a/Gemfile b/Gemfile index d72a67d..b3a0161 100644 --- a/Gemfile +++ b/Gemfile @@ -5,9 +5,9 @@ source "https://rubygems.org" # Specify your gem's dependencies in jwk-loader.gemspec gemspec -gem "rake", "~> 13.0" -gem "rspec", "~> 3.0" -gem "rubocop", "~> 1.32.0" +gem "rake" +gem "rspec" +gem "rubocop" gem "simplecov" gem "vcr" gem "webmock"