Skip to content

Commit

Permalink
[build] create a stage release workflow for after the pre-release PR …
Browse files Browse the repository at this point in the history
…is merged
  • Loading branch information
titusfortner committed Jun 12, 2024
1 parent 6453efd commit 45db5d2
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 36 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/stage-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Release Staging

on:
pull_request:
types: [closed]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
generate-packages:
if: >
github.event.pull_request.merged == true &&
github.repository_owner == 'seleniumhq' &&
startsWith(github.event.pull_request.head.ref, 'release-preparation-')
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Extract version from branch name
id: extract_version
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION="${BASH_REMATCH[1]}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Stage Java packages
run: ./go java:package['--config=release']
- name: Stage .NET packages
run: ./go dotnet:package['--config=release']
- name: Build Ruby
run: ./go rb:build['--config=release']
- name: Build Python
run: ./go py:build['--config=release']
- name: Build Node
run: ./go node:build['--config=release']
- name: "Upload releases"
uses: actions/upload-artifact@v4
with:
name: release-assets
path: build/dist/
retention-days: 6
- name: Prep git
run: |
git config --local user.email "selenium-ci@users.noreply.github.com"
git config --local user.name "Selenium CI Bot"
- name: Update tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag selenium-${{ env.VERSION }}
git push selenium-${{ env.VERSION }}
- name: "Release"
uses: softprops/action-gh-release@v2
with:
name: Selenium ${{ env.VERSION }}
body: |
### Changelogs
For each component's detailed changelog, please check:
* [Ruby](https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES)
* [Python](https://github.com/SeleniumHQ/selenium/blob/trunk/py/CHANGES)
* [JavaScript](https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/node/selenium-webdriver/CHANGES.md)
* [Java](https://github.com/SeleniumHQ/selenium/blob/trunk/java/CHANGELOG)
* [DotNet](https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/CHANGELOG)
* [IEDriverServer](https://github.com/SeleniumHQ/selenium/blob/trunk/cpp/iedriverserver/CHANGELOG)
tag_name: selenium-${{ env.VERSION }}
draft: true
generate_release_notes: true
prerelease: false
files: |
artifacts/release-assets/selenium-dotent-${{ env.VERSION }}.zip
artifacts/release-assets/selenium-dotent-strongnamed-${{ env.VERSION }}.zip
artifacts/release-assets/selenium-java-${{ env.VERSION }}.zip
artifacts/release-assets/selenium-server-${{ env.VERSION }}.jar
artifacts/release-assets/selenium-server-${{ env.VERSION }}.zip
36 changes: 0 additions & 36 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -1067,16 +1067,13 @@ namespace :all do
desc 'Release all artifacts for all language bindings'
task :release, [:args] do |_task, arguments|
Rake::Task['clean'].invoke
tag = @git.add_tag("selenium-#{java_version}")
@git.push('origin', tag.name)

args = Array(arguments[:args] || ['--stamp'])
Rake::Task['java:release'].invoke(args)
Rake::Task['py:release'].invoke(args)
Rake::Task['rb:release'].invoke(args)
Rake::Task['dotnet:release'].invoke(args)
Rake::Task['node:release'].invoke(args)
Rake::Task['create_release_notes'].invoke(args)
Rake::Task['all:docs'].invoke
Rake::Task['all:version'].invoke('nightly')

Expand Down Expand Up @@ -1168,39 +1165,6 @@ at_exit do
system 'sh', '.git-fixfiles' if File.exist?('.git') && !SeleniumRake::Checks.windows?
end

desc 'Create Release Notes for Minor Release'
task :create_release_notes do
range = "#{previous_tag(java_version)}...HEAD"
format = "* [\\`%h\\`](http://github.com/seleniumhq/selenium/commit/%H) - %s :: %aN"
git_log_command = %Q(git --no-pager log "#{range}" --pretty=format:"#{format}" --reverse)
git_log_output = `#{git_log_command}`

release_notes = <<~RELEASE_NOTES
### Changelog
For each component's detailed changelog, please check:
* [Ruby](https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES)
* [Python](https://github.com/SeleniumHQ/selenium/blob/trunk/py/CHANGES)
* [JavaScript](https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/node/selenium-webdriver/CHANGES.md)
* [Java](https://github.com/SeleniumHQ/selenium/blob/trunk/java/CHANGELOG)
* [DotNet](https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/CHANGELOG)
* [IEDriverServer](https://github.com/SeleniumHQ/selenium/blob/trunk/cpp/iedriverserver/CHANGELOG)
### Commits in this release
<details>
<summary>Click to see all the commits included in this release</summary>
#{git_log_output}
</details>
RELEASE_NOTES

FileUtils.mkdir_p('build/dist')
release_notes_file = "build/dist/release_notes_#{java_version}.md"
File.write(release_notes_file, release_notes)
puts "Release notes have been generated at: #{release_notes_file}"
end

def updated_version(current, desired = nil, nightly = nil)
if !desired.nil? && desired != 'nightly'
# If desired is present, return full 3 digit version
Expand Down

0 comments on commit 45db5d2

Please sign in to comment.