You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2023/09/10 04:53:29 UTC

[arrow-flight-sql-postgresql] branch main updated: Document how to verify release candidate (#92)

This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-flight-sql-postgresql.git


The following commit(s) were added to refs/heads/main by this push:
     new 3fe7cba  Document how to verify release candidate (#92)
3fe7cba is described below

commit 3fe7cba61bd9e6df71adbbbeb16110aefbf4805d
Author: Sutou Kouhei <ko...@clear-code.com>
AuthorDate: Sun Sep 10 13:53:25 2023 +0900

    Document how to verify release candidate (#92)
    
    Closes GH-88
    
    This may have problems in our first release process. We can fix it when
    we find them.
---
 .github/workflows/package.yaml    | 145 +++++++++++++----
 .github/workflows/release.yaml    |  55 +++++++
 Rakefile                          | 296 +++++++++++++++++++++++++++++++---
 dev/release/.env.example          |  10 +-
 dev/release/verify-rc.sh          | 323 ++++++++++++++++++++++++++++++++++++++
 doc/source/development/release.md | 208 ++++++++++++++++++++++++
 doc/source/index.md               |   6 +
 doc/source/overview.md            |   4 +
 doc/source/release-notes.md       |   2 +-
 package/apt/test.sh               | 113 ++++++++++---
 10 files changed, 1075 insertions(+), 87 deletions(-)

diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml
index 45f694a..bbfa489 100644
--- a/.github/workflows/package.yaml
+++ b/.github/workflows/package.yaml
@@ -20,6 +20,10 @@ name: Package
 on:
   pull_request:
   push:
+    branches:
+      - "*"
+    tags:
+      - "*-rc*"
 
 concurrency:
   group: ${{ github.head_ref || github.sha }}-${{ github.workflow }}
@@ -30,38 +34,8 @@ permissions:
   packages: write
 
 jobs:
-  release:
-    if: >-
-      github.ref_type == 'tag' && !contains(github.ref_name, 'rc')
-    name: Release
-    timeout-minutes: 5
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v4
-      - name: Make RC GA
-        run: |
-          rc_tag=$(gh release list | \
-                     cut -d'	' -f3 | \
-                     grep -F "${GITHUB_REF_NAME}-rc" | \
-                     head -n1)
-          title="$(gh release view ${rc_tag} --json name --jq .name | \
-                     sed -E -e 's/ RC[0-9]+$//')"
-          gh release view ${rc_tag} --json body --jq .body > release-note.md
-          mkdir rc_artifacts
-          gh release download ${rc_tag} --dir rc_artifacts
-          gh release create ${GITHUB_REF_NAME} \
-            --notes-file release-note.md \
-            --title "${title}" \
-            --verify-tag \
-            rc_artifacts/*
-        env:
-          GH_TOKEN: ${{ github.token }}
-
   source:
     name: Source
-    if: >-
-      github.ref_type == 'branch' ||
-        (github.ref_type == 'tag' && contains(github.ref_name, 'rc'))
     timeout-minutes: 5
     runs-on: ubuntu-latest
     steps:
@@ -82,7 +56,7 @@ jobs:
         run: |
           ruby \
             -e 'print("## Apache Arrow Flight SQL adapter for PostgreSQL "); \
-                puts(ARGF.read.split(/^## /)[1]. \
+                puts(ARGF.read.split(/^## Version /)[1]. \
                        gsub(/ {.+?}/, ""). \
                        gsub(/\[(.+?)\]\[.+?\]/) {$1})' \
             doc/source/release-notes.md > release-note.md
@@ -99,9 +73,6 @@ jobs:
 
   linux:
     name: Linux
-    if: >-
-      github.ref_type == 'branch' ||
-        (github.ref_type == 'tag' && contains(github.ref_name, 'rc'))
     needs:
       - source
     runs-on: ubuntu-latest
@@ -212,5 +183,111 @@ jobs:
             --volume ${PWD}:/host \
             ${ARCHITECTURE}/${DISTRIBUTION}:${DISTRIBUTION_VERSION} \
             /host/package/${TASK_NAMESPACE}/test.sh \
+            ${VERSION} \
+            local \
             package/${PACKAGE}/${TASK_NAMESPACE}/repositories
           popd
+
+  verify-source:
+    name: Verify source on ${{ matrix.os }}
+    needs:
+      - source
+    runs-on: ${{ matrix.os }}-latest
+    timeout-minutes: 15
+    strategy:
+      fail-fast: false
+      matrix:
+        os:
+          - macos
+          - ubuntu
+        postgresql-version:
+          - "15"
+    env:
+      BUNDLE_GEMFILE: ${{ github.workspace }}/apache-arrow-flight-sql-postgresql/Gemfile
+    steps:
+      - uses: actions/download-artifact@v3
+        with:
+          name: source
+      - name: Extract source archive
+        run: |
+          tar_gz=$(echo apache-arrow-flight-sql-postgresql-*.tar.gz)
+          tar xf ${tar_gz}
+          ln -s ${tar_gz%.tar.gz} apache-arrow-flight-sql-postgresql
+      - name: Install dependencies on Ubuntu
+        if: matrix.os == 'ubuntu'
+        run: |
+          sudo apt update
+          sudo apt install -y -V \
+            ca-certificates \
+            gpg \
+            lsb-release \
+            wget
+          os=$(lsb_release --id --short | tr 'A-Z' 'a-z')
+          code_name=$(lsb_release --codename --short)
+
+          apt_source_deb=apache-arrow-apt-source-latest-${code_name}.deb
+          wget https://apache.jfrog.io/artifactory/arrow/${os}/${apt_source_deb}
+          sudo apt install -y -V ./${apt_source_deb}
+
+          wget -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
+            sudo gpg --no-default-keyring --keyring /usr/share/keyrings/pgdg.gpg --import -
+          (echo "Types: deb"; \
+           echo "URIs: http://apt.postgresql.org/pub/repos/apt"; \
+           echo "Suites: ${code_name}-pgdg"; \
+           echo "Components: main"; \
+           echo "Signed-By: /usr/share/keyrings/pgdg.gpg") | \
+            sudo tee /etc/apt/sources.list.d/pgdg.sources
+
+          sudo apt update
+          sudo apt -y -V purge '^postgresql'
+          sudo apt install -y -V \
+            libarrow-flight-sql-glib-dev \
+            libkrb5-dev \
+            meson \
+            ninja-build \
+            postgresql-${{ matrix.postgresql-version }} \
+            postgresql-server-dev-${{ matrix.postgresql-version }}
+      - name: Install dependencies on macOS
+        if: matrix.os == 'macos'
+        run: |
+          pushd apache-arrow-flight-sql-postgresql
+          sed \
+            -i '' \
+            -e 's/postgresql@[0-9]*/postgresql@${{ matrix.postgresql-version }}/g' \
+            Brewfile
+          brew update
+          brew bundle
+          echo "$(brew --prefix postgresql@${{ matrix.postgresql-version }})/bin" >> $GITHUB_PATH
+          popd
+      - uses: ruby/setup-ruby@v1
+        with:
+          ruby-version: ruby
+          bundler-cache: true
+          cache-version: 1
+      - name: Run
+        run: |
+          pushd apache-arrow-flight-sql-postgresql
+          bundle exec dev/release/verify-rc.sh
+          popd
+        env:
+          TEST_DEFAULT: "0"
+          TEST_SOURCE: "1"
+
+  verify-binaries:
+    name: Verify binaries
+    if: >-
+      github.ref_type == 'tag'
+    needs:
+      - linux
+    runs-on: ubuntu-latest
+    timeout-minutes: 10
+    steps:
+      - uses: actions/checkout@v4
+      - name: Run
+        run: |
+          version=${GITHUB_REF_NAME%-rc*}
+          rc=${GITHUB_REF_NAME#*-rc}
+          dev/release/verify-rc.sh ${version} ${rc}
+        env:
+          TEST_BINARIES: "1"
+          TEST_DEFAULT: "0"
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
new file mode 100644
index 0000000..5f27592
--- /dev/null
+++ b/.github/workflows/release.yaml
@@ -0,0 +1,55 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Release
+
+on:
+  push:
+    branches:
+      - "!**"
+    tags:
+      - "*"
+      - "!*-rc*"
+
+permissions:
+  contents: write
+
+jobs:
+  publish:
+    name: Publish
+    timeout-minutes: 5
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - name: Make RC GA
+        run: |
+          rc_tag=$(gh release list | \
+                     cut -d'	' -f3 | \
+                     grep -F "${GITHUB_REF_NAME}-rc" | \
+                     head -n1)
+          title="$(gh release view ${rc_tag} --json name --jq .name | \
+                     sed -E -e 's/ RC[0-9]+$//')"
+          gh release view ${rc_tag} --json body --jq .body > release-note.md
+          mkdir rc_artifacts
+          gh release download ${rc_tag} --dir rc_artifacts
+          gh release create ${GITHUB_REF_NAME} \
+            --notes-file release-note.md \
+            --title "${title}" \
+            --verify-tag \
+            rc_artifacts/*
+        env:
+          GH_TOKEN: ${{ github.token }}
diff --git a/Rakefile b/Rakefile
index 657eaae..ec834f6 100644
--- a/Rakefile
+++ b/Rakefile
@@ -19,6 +19,7 @@
 
 require "digest/sha2"
 require "json"
+require "open-uri"
 require "tmpdir"
 
 require_relative "helper"
@@ -134,6 +135,10 @@ def env_value(name, default=nil)
   value || default
 end
 
+def push_automatically?
+  env_value("PUSH", "no") == "yes"
+end
+
 def github_repository
   env_value("GITHUB_REPOSITORY", "apache/arrow-flight-sql-postgresql")
 end
@@ -146,8 +151,20 @@ def arrow_source
   env_value("ARROW_SOURCE")
 end
 
+def release_remote
+  env_value("RELEASE_REMOTE", "release")
+end
+
+def sh_capture_output(*command_line)
+  IO.pipe do |read, write|
+    sh(*command_line, out: write)
+    write.close
+    read.read
+  end
+end
+
 def detect_latest_rc(version)
-  rc_tags = `git tag`.each_line(chomp: true).select do |tag|
+  rc_tags = sh_capture_output("git", "tag").each_line(chomp: true).select do |tag|
     tag.start_with?("#{version}-rc")
   end
   rcs = rc_tags.collect do |rc_tag|
@@ -164,10 +181,51 @@ def debian_changelog_latest_version(changelog_path)
   (File.readlines(changelog_path)[0] || "")[/\(([\d.]+)-\d+\)/, 1]
 end
 
+def git_remote_url(name)
+  sh_capture_output("git", "remote", "get-url", "--push", name).chomp
+end
+
+def git_current_branch
+  sh_capture_output("git", "rev-parse", "--abbrev-ref=HEAD").chomp
+end
+
+def git_last_commit(branch="HEAD")
+  sh_capture_output("git", "log", "-n", "1", "--format=format:%H", branch).chomp
+end
+
+def repository_url_extract_repository(url)
+  if url.start_with?("https://")
+    # https://github.com/apache/arrow-flight-sql-postgresql.git ->
+    # apache/arrow-flight-sql-postgresql.git
+    repository = url.split("/")[-2..-1].join("/")
+  else
+    # git@github.com:apache/arrow-flight-sql-postgresql.git ->
+    # apache/arrow-flight-sql-postgresql.git
+    repository = url.split(":").last
+  end
+  respoitory.delete_suffix(".git")
+end
+
+def repository_last_commit(repository)
+  URI("https://api.github.com/repos/#{repository}/branches/main").open do |input|
+    JSON.parse(input.read)["commit"]["sha"]
+  end
+end
+
+def ci_conclusions(repository, branch, commit)
+  jq_filter = ".[] | select(.headSha == \"#{commit}\") | .conclusion"
+  sh_capture_output("gh", "run", "list",
+                    "--repo", repository,
+                    "--branch", branch,
+                    "--json", "headSha,conclusion",
+                    "--jq", jq_filter).
+    lines(chomp: true)
+end
+
 def validate_rc(version)
   package_directories.each do |dir|
     latest_version = debian_changelog_latest_version("#{dir}/debian/changelog")
-    if latest_version != version
+    unless latest_version == version
       raise "'rake release:rc:prepare && git push' is needed"
     end
   end
@@ -175,9 +233,27 @@ def validate_rc(version)
   release_notes = File.read("doc/source/release-notes.md").split(/^## /)
   latest_release_note = release_notes[1]
   latest_release_note_version = latest_release_note.lines[0].strip
-  if latest_release_note_version != version
+  unless latest_release_note_version == version
     raise "add a release note to doc/source/release-notes.md"
   end
+
+  current_branch = git_current_branch
+  unless current_branch == "main"
+    raise "work on main not a branch: #{current_branch}"
+  end
+
+  local_commit = git_last_commit
+  release_repository_url = git_remote_url(release_remote)
+  release_repository = repository_url_extract_repository(release_repository_url)
+  remote_commit = repository_last_commit(release_repository)
+  unless remote_commit == local_commit
+    raise "local commit isn't synchronized with release remote: #{release_repository}"
+  end
+
+  conclusions = ci_conclusions(release_repository, "main", remote_commit)
+  unless conclusions.all? {|conclusion| conclusion == "success"}
+    raise "CI failed: https://github.com/#{release_repository}/commit/#{remote_commit}"
+  end
 end
 
 def ensure_package_job_finished(rc_tag)
@@ -203,9 +279,10 @@ end
 
 namespace :release do
   namespace :rc do
-    desc "Prepare a new RC"
+    desc "Prepare new release"
     task :prepare do
-      prepared = false
+      prepare_branch = "prepare-#{version}"
+      sh("git", "switch", "-c", prepare_branch)
       package_directories.each do |dir|
         cd(dir) do
           debian_changelog = "debian/changelog"
@@ -213,25 +290,48 @@ namespace :release do
           next if latest_version == version
           ruby("-S", "rake", "version:update")
           sh("git", "add", debian_changelog)
-          prepared = true
         end
       end
-      sh("git", "commit", "-m", "Prepare #{version} RC #{new_rc}")
+      sh("git", "commit", "-m", "Prepare #{version}")
+      if push_automatically?
+        sh("git", "push", "origin", prepare_branch)
+      else
+        puts("Push #{prepare_branch}:")
+        puts("  git push origin #{prepare_branch}")
+      end
+      puts("Open a PR:")
+      puts("  https://github.com/apache/arrow-flight-sql-postgresql/pulls")
     end
 
-    desc "Tag a new RC"
-    task :tag do
+    desc "Ensure remote for releasing"
+    task :ensure_release_remote do
+      begin
+        git_remote_url(release_remote)
+      rescue RuntimeError => error
+        raise unless error.message.start_with?("Command failed")
+        sh("git", "remote", "add",
+           release_remote,
+           "git@github.com:apache/arrow-flight-sql-postgresql.git")
+      end
+    end
+
+    desc "Validation before a new RC"
+    task :validate do
       validate_rc(version)
+    end
+
+    desc "Tag for a new RC"
+    task :tag => [:ensure_release_remote, :validate] do
       new_rc = (detect_latest_rc(version) || 0) + 1
       rc_tag = "#{version}-rc#{new_rc}"
       sh("git", "tag",
          "-a", rc_tag,
          "-m", "#{project_label} #{version} RC #{new_rc}")
-      if env_value("TAG_PUSH", "no") == "yes"
-        sh("git", "push", "upstream", rc_tag)
+      if push_automatically?
+        sh("git", "push", release_remote, rc_tag)
       else
         puts("Push #{rc_tag}:")
-        puts("  git push upstream #{rc_tag}")
+        puts("  git push #{release_remote} #{rc_tag}")
       end
     end
 
@@ -314,15 +414,8 @@ namespace :release do
         raise "'rake release:rc:tag && git push ...' is needed"
       end
       rc_tag = "#{version}-rc#{rc}"
-      commit = IO.pipe do |read, write|
-        sh("git", "rev-list", "-n", "1", rc_tag, write: write)
-        write.close
-        read.read.strip
-      end
+      commit = git_last_commit(rc_tag)
       puts(<<-MAIL)
-    local -r commit=$(git rev-list -n 1 "${tag}")
-
-    cat <<MAIL
 To: dev@arrow.apache.org
 Subject: [VOTE] Release Apache Arrow Flight SQL adapter for PostgreSQL ${version} - RC#{rc}
 
@@ -352,7 +445,7 @@ Flight SQL adapter for PostgreSQL doesn't reach 1.0.0 yet.
 [2]: https://github.com/apache/arrow-flight-sql-postgresql/releases/tag/#{rc_tag}
 [3]: https://apache.jfrog.io/artifactory/arrow/debian-rc/
 [4]: https://apache.jfrog.io/artifactory/arrow/ubuntu-rc/
-[5]: https://arrow.apache.org/flight-sql-postgresql/devel/release.html#how-to-verify-release-candidates
+[5]: https://arrow.apache.org/flight-sql-postgresql/devel/development/release.html#how-to-verify
       MAIL
     end
 
@@ -407,11 +500,11 @@ Flight SQL adapter for PostgreSQL doesn't reach 1.0.0 yet.
            "-a", version,
            "-m", "#{project_label} #{version}",
            "#{rc_tag}^{}")
-        if env_value("TAG_PUSH", "no") == "yes"
-          sh("git", "push", "upstream", version)
+        if push_automatically?
+          sh("git", "push", release_remote, version)
         else
           puts("Push #{version}:")
-          puts("  git push upstream #{version}")
+          puts("  git push #{release_remote} #{version}")
         end
       end
     end
@@ -424,4 +517,159 @@ Flight SQL adapter for PostgreSQL doesn't reach 1.0.0 yet.
            "release:rc:publish:tag",
          ]
   end
+
+  namespace :announce do
+    desc "Show blog announce template"
+    task :blog do
+      previous_version = env_value("PREVIOUS_VERSION")
+      commit_range = "#{previous_version}..#{version}"
+      n_commits = sh_capture_output("git", "rev-list", "--count", commit_range).chomp
+      contributor_command = [
+        "git",
+        "shortlog",
+        "--perl-regexp",
+        "--author='^((?!dependabot\[bot\]).*)$'",
+        "-sn",
+        commit_range,
+      ]
+      contributors = sh_capture_output(*contributor_command)
+      n_contributors = contributors.lines.size
+      post_date = env_value("POST_DATE", Date.today.strftime("%Y-%m-%d"))
+      puts(<<-POST)
+---
+layout: post
+title: "Apache Arrow Flight SQL adapter for PostgreSQL #{version} Release"
+date: "#{post_date} 00:00:00"
+author: pmc
+categories: [release]
+---
+{% comment %}
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+{% endcomment %}
+
+The Apache Arrow team is pleased to announce the #{version} release of
+the Apache Arrow Flight SQL adapter for PostgreSQL. This includes
+[**#{n_commits} commits][commits] from [**#{n_contributors} distinct
+contributors**][contributors].
+
+The release notes below are not exhaustive and only expose selected
+highlights of the release. Many other bugfixes and improvements have
+been made: we refer you to [the complete release notes][release-note].
+
+## Release Highlights
+
+<!-- TODO: fill this portion in. -->
+
+## Contributors
+
+```console
+$ #{contributor_command.join(" ")}
+#{contributors}
+```
+
+## Roadmap
+
+<!-- TODO: fill this portion in. -->
+
+## Getting Involved
+
+We welcome questions and contributions from all interested. Issues can
+be filed on [GitHub][issues], and questions can be directed to GitHub or
+[the Arrow mailing lists][mailing-list].
+
+[commits]: ${MILESTONE_URL}
+[contributors]: #contributors
+[release-note]: https://arrow.apache.org/flight-sql-postgresql/current/release-notes.html\#version-#{version}
+[issues]: https://github.com/apache/arrow-flight-sql-postgresql/issues
+[mailing-list]: {% link community.md %}
+      POST
+    end
+
+    desc "Show mail announce template"
+    task :mail do
+      blog_path_date = Date.today("%Y/%m/%d")
+      # Extract the first "## ..." section.
+      overview = File.read("doc/source/overview.md").split(/^## /)[1]
+      # Remove links:
+      #   [Apache Arrow Flight SQL][apache-arrow-flight-sql] ->
+      #   Apache Arrow Flight SQL
+      overview.gsub!(/\[(.+?)\]\[.+?\]/m, "\\1")
+      puts(<<-MAIL)
+To: announce@apache.org, user@arrow.apache.org, dev@arrow.apache.org
+From: XXX@apache.org
+Subject: [ANNOUNCE] Apache Arrow Flight SQL adapter for PostgreSQL #{version} released
+
+The Apache Arrow team is pleased to announce the #{version} release of
+the Apache Arrow Flight SQL adapter for PostgreSQL.
+
+The release is available now from our website:
+  https://arrow.apache.org/flight-sql-postgresql/#{version}/install/
+
+Read about what's new in the release:
+  https://arrow.apache.org/blog/#{blog_path_date}/flight-sql-postgresql-#{version}-release/
+
+Release note:
+  https://arrow.apache.org/flight-sql-postgresql/#{version}/release-note.html\#version-#{version}
+
+
+#{overview}
+
+
+Please report any feedback to the GitHub issues or mailing lists:
+  * GitHub: https://github.com/apache/arrow-flight-sql-postgresql/issues
+  * ML: https://arrow.apache.org/community/
+
+
+Thanks,
+-- 
+The Apache Arrow community
+      MAIL
+    end
+
+    desc "Show PostgreSQL announce template"
+    task :postgresql do
+      puts(<<-ANNOUNCE)
+TODO
+      ANNOUNCE
+    end
+  end
+
+  namespace :version do
+    desc "Bump version"
+    task :bump do
+      new_version = env_value("NEW_VERSION")
+      bump_version_branch = "bump-version-#{new_version}"
+      sh("git", "switch", "-c", bump_version_branch)
+      meson_build = File.read("meson.build")
+      new_meson_build = meson_build.gsub(/version: '.+?'/) do
+        "version: '#{new_version}'"
+      end
+      File.write("meson.build", new_meson_build)
+      sh("git", "add", "meson.build")
+      sh("git", "commit", "-m", "Bump version to #{new_version}")
+      if push_automatically?
+        sh("git", "push", "origin", bump_version_branch)
+      else
+        puts("Push #{bump_version_branch}:")
+        puts("  git push origin #{bump_version_branch}")
+      end
+      puts("Open a PR:")
+      puts("  https://github.com/apache/arrow-flight-sql-postgresql/pulls")
+    end
+  end
 end
diff --git a/dev/release/.env.example b/dev/release/.env.example
index 11ff241..c605d3a 100644
--- a/dev/release/.env.example
+++ b/dev/release/.env.example
@@ -26,10 +26,12 @@
 # You must set this.
 #GPG_KEY_ID=08D3564B7C6A9CAFBFF6A66791D18FCF079F8007
 
-# The Artifactory API key to upload artifacts to Artifactory.
+# The GitHub personal access token that must have at least "workflow"
+# scope.
 #
-# This can be obtained by logging in to https://apache.jfrog.io with
-# your ASF credentials and generating an API key from your user profile.
+# See
+#  https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
+# for details.
 #
 # You must set this.
-#ARTIFACTORY_API_KEY=secret
+#GH_TOKEN=secret
diff --git a/dev/release/verify-rc.sh b/dev/release/verify-rc.sh
new file mode 100755
index 0000000..3998b12
--- /dev/null
+++ b/dev/release/verify-rc.sh
@@ -0,0 +1,323 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -eo pipefail
+
+if [ ${VERBOSE:-0} -gt 0 ]; then
+  set -x
+fi
+
+case $# in
+  0)
+    VERSION="HEAD"
+    SOURCE_KIND="local"
+    TEST_BINARIES=0
+    ;;
+  1)
+    VERSION="$1"
+    SOURCE_KIND="git"
+    TEST_BINARIES=0
+    ;;
+  2)
+    VERSION="$1"
+    RC_NUMBER="$2"
+    SOURCE_KIND="tarball"
+    ;;
+  *)
+    echo "Usage:"
+    echo "  Verify release candidate:"
+    echo "    $0 X.Y.Z RC_NUMBER"
+    echo "  Verify only the source distribution:"
+    echo "    TEST_DEFAULT=0 TEST_SOURCE=1 $0 X.Y.Z RC_NUMBER"
+    echo "  Verify only the binary distributions:"
+    echo "    TEST_DEFAULT=0 TEST_BINARIES=1 $0 X.Y.Z RC_NUMBER"
+    echo ""
+    echo "  Run the source verification tasks on a remote git revision:"
+    echo "    $0 GIT-REF"
+    echo "  Run the source verification tasks on this arrow checkout:"
+    echo "    $0"
+    exit 1
+    ;;
+esac
+
+# Note that these point to the current verify-rc.sh directories
+# which is different from the ADBC_SOURCE_DIR set in ensure_source_directory()
+SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
+TOP_SOURCE_DIR="$(cd "${SOURCE_DIR}/../.." && pwd)"
+
+: ${SOURCE_REPOSITORY:="apache/arrow-flight-sql-postgresql"}
+
+show_header() {
+  echo ""
+  printf '=%.0s' $(seq ${#1}); printf '\n'
+  echo "${1}"
+  printf '=%.0s' $(seq ${#1}); printf '\n'
+}
+
+show_info() {
+  echo "└ ${1}"
+}
+
+ARROW_DIST_URL="https://dist.apache.org/repos/dist/dev/arrow"
+
+download_dist_file() {
+  curl \
+    --silent \
+    --show-error \
+    --fail \
+    --location \
+    --remote-name "${ARROW_DIST_URL}/$1"
+}
+
+download_rc_file() {
+  local file="$1"
+  local releases_url="https://github.com/${SOURCE_REPOSITORY}/releases"
+  curl \
+    --silent \
+    --show-error \
+    --fail \
+    --location \
+    --remote-name "${releases_url}/tag/${VERSION}-rc${RC_NUMBER}/${file}"
+}
+
+import_gpg_keys() {
+  if [ "${GPGKEYS_ALREADY_IMPORTED:-0}" -gt 0 ]; then
+    return 0
+  fi
+  download_dist_file KEYS
+  gpg --import KEYS
+
+  GPGKEYS_ALREADY_IMPORTED=1
+}
+
+if type shasum >/dev/null 2>&1; then
+  sha512_verify="shasum -a 512 -c"
+else
+  sha512_verify="sha512sum -c"
+fi
+
+fetch_archive() {
+  import_gpg_keys
+
+  local dist_name=$1
+  download_rc_file ${dist_name}.tar.gz
+  download_rc_file ${dist_name}.tar.gz.asc
+  download_rc_file ${dist_name}.tar.gz.sha512
+  gpg --verify ${dist_name}.tar.gz.asc ${dist_name}.tar.gz
+  ${sha512_verify} ${dist_name}.tar.gz.sha512
+}
+
+setup_tempdir() {
+  cleanup() {
+    if [ "${TEST_SUCCESS}" = "yes" ]; then
+      rm -fr "${ARROW_TMPDIR}"
+    else
+      echo "Failed to verify release candidate. See ${ARROW_TMPDIR} for details."
+    fi
+  }
+
+  show_header "Creating temporary directory"
+
+  if [ -z "${ARROW_TMPDIR}" ]; then
+    # clean up automatically if ARROW_TMPDIR is not defined
+    ARROW_TMPDIR=$(mktemp -d -t "arrow-flight-sql-postgresql-${VERSION}.XXXXX")
+    trap cleanup EXIT
+  else
+    # don't clean up automatically
+    mkdir -p "${ARROW_TMPDIR}"
+  fi
+
+  echo "Working in sandbox ${ARROW_TMPDIR}"
+}
+
+ensure_source_directory() {
+  show_header "Ensuring source directory"
+
+  dist_name="apache-arrow-flight-sql-postgresql-${VERSION}"
+  if [ "${SOURCE_KIND}" = "local" ]; then
+    # Local repository, testing repositories should be already present
+    if [ -z "${TOP_SOURCE_DIR}" ]; then
+      export TARGET_SOURCE_DIR="${TOP_SOURCE_DIR}"
+    fi
+    echo "Verifying local checkout at ${TARGET_SOURCE_DIR}"
+  elif [ "${SOURCE_KIND}" = "git" ]; then
+    # Remote repository, testing repositories must be cloned
+    echo "Verifying repository ${SOURCE_REPOSITORY} with revision checkout ${VERSION}"
+    export TARGET_SOURCE_DIR="${ARROW_TMPDIR}/arrow-flight-sql-postgresql"
+    if [ ! -d "${TARGET_SOURCE_DIR}" ]; then
+      git clone \
+          --branch ${VERSION} \
+          --recurse-submodules \
+          https://github.com/${SOURCE_REPOSITORY} \
+          "${TARGET_SOURCE_DIR}"
+    fi
+  else
+    # Release tarball, testing repositories must be cloned separately
+    echo "Verifying official release candidate ${VERSION}-rc${RC_NUMBER}"
+    export TARGET_SOURCE_DIR="${ARROW_TMPDIR}/${dist_name}"
+    if [ ! -d "${TARGET_SOURCE_DIR}" ]; then
+      pushd "${ARROW_TMPDIR}"
+      mkdir -p "${TARGET_SOURCE_DIR}"
+      fetch_archive ${dist_name}
+      tar -C "${TARGET_SOURCE_DIR}" --strip-components 1 -xf "${dist_name}.tar.gz"
+      popd
+    fi
+  fi
+}
+
+test_source_distribution() {
+  pushd "${TARGET_SOURCE_DIR}"
+
+  show_header "Build"
+
+  if ! type pg_config > /dev/null 2>&1; then
+    if brew --prefix --installed postgresql@15 > /dev/null 2>&1; then
+      PATH="$(brew --prefix --installed postgresql@15):${PATH}"
+    else
+      echo "PostgreSQL isn't installed. You need PostgreSQL 15 or later."
+      if type brew > /dev/null 2>&1; then
+        echo "You can install PostgreSQL 15 by the following command line:"
+        echo "  brew install postgresql@15"
+      elif type apt info postgresql-server-dev-15 > /dev/null 2>&1; then
+        echo "You can install PostgreSQL 15 by the following command line:"
+        echo "  sudo apt install -V postgresql{,-server-dev}-15"
+      fi
+      return 1
+    fi
+  fi
+
+  meson setup \
+        --prefix="${PWD}/install" \
+        -Dpostgresql_dir="$(pg_config --bindir)/.." \
+        build
+  meson compile -C build
+  if [ ${TEST_SOURCE_MANUAL} -gt 0 ]; then
+    echo "Please test the built artifacts!"
+    echo
+    echo "Hints:"
+    echo "  * You can install by 'meson install -C build'"
+    echo "  * You can run PostgreSQL by 'dev/run-postgresql.sh /tmp/afs'"
+    echo "  * Flight SQL endpoint is grpc://127.0.0.1:15432"
+    echo "  * We don't have command line Flight SQL client yet."
+    echo "    You need to write a program to connect Flight SQL server for now..."
+    echo "  * If you find any problem, you should exit this shell by 'exit 1'"
+    echo "    to tell that your verification failed"
+    echo "  * If you don't have any Flight SQL client, you may want to just finish"
+    echo "    this verification by exiting this shell"
+    ${SHELL}
+  else
+    case "$(uname)-$(pg_config --libdir)" in
+      Linux-/usr/*)
+        if type sudo > /dev/null 2>&1; then
+          sudo meson install -C build
+        else
+          meson install -C build
+        fi
+        ;;
+      *)
+        meson install -C build
+        ;;
+    esac
+    PATH="$(pg_config --bindir):${PATH}" ruby test/run.rb
+  fi
+
+  popd
+}
+
+test_apt() {
+  pushd "${TARGET_SOURCE_DIR}"
+
+  show_header "Testing APT packages"
+
+  if [ "${GITHUB_ACTIONS}" = "true" ]; then
+    local verify_type=rc
+    if [ "${TEST_STAGING:-0}" -gt 0 ]; then
+      verify_type=staging-${verify_type}
+    fi
+    for target in "debian:bookworm" \
+                  "ubuntu:jammy"; do \
+      show_info "Verifying ${target}..."
+      if ! docker run \
+           --rm \
+           --security-opt="seccomp=unconfined" \
+           --volume "${PWD}":/host:delegated \
+           "${target}" \
+           /host/package/apt/test.sh \
+           "${VERSION}" \
+           "${verify_type}"; then
+        echo "Failed to verify the APT repository for ${target}"
+        exit 1
+      fi
+    done
+  else
+    curl --get \
+         --data branch=${VERSION}-${RC_NUMBER} \
+         https://api.github.com/repos/${SOURCE_REPOSITORY}/actions/workflows/package.yaml/runs > \
+         package_run.json
+    if [ $(jq -r '.total_count' package_run.json) -eq 0 ]; then
+      echo "APT packages test on GitHub Actions isn't ran yet."
+      return 1
+    fi
+    echo "APT packages test was ran on GitHub Actions:"
+    echo "  $(jq -r '.workflow_runs[0].html_url' package_run.json)"
+    conclusion="$(jq -r '.workflow_runs[0].conclusion' package_run.json)"
+    if [ "${conclusion}" != "success" ]; then
+      echo "It was not succeeded: ${conclusion}"
+      return 1
+    fi
+  fi
+
+  popd
+}
+
+test_binary_distribution() {
+  test_apt
+}
+
+# By default test all functionalities.
+# To deactivate one test, deactivate the test and all of its dependents
+# To explicitly select one test, set TEST_DEFAULT=0 TEST_X=1
+: ${TEST_DEFAULT:=1}
+
+# Verification groups
+: ${TEST_SOURCE:=${TEST_DEFAULT}}
+: ${TEST_BINARIES:=${TEST_DEFAULT}}
+
+if [ "${GITHUB_ACTIONS:-}" = "true" ] || \
+     ruby -r arrow-flight-sql -e 'true' > dev/null 2>&1; then
+  : ${TEST_SOURCE_MANUAL:=0}
+else
+  : ${TEST_SOURCE_MANUAL:=1}
+fi
+
+TEST_SUCCESS=no
+
+setup_tempdir
+ensure_source_directory
+if [ ${TEST_SOURCE} -gt 0 ]; then
+  test_source_distribution
+fi
+if [ ${TEST_BINARY} -gt 0 ]; then
+  test_binary_distribution
+fi
+
+TEST_SUCCESS=yes
+
+echo "Release candidate looks good!"
+exit 0
diff --git a/doc/source/development/release.md b/doc/source/development/release.md
new file mode 100644
index 0000000..3a73d75
--- /dev/null
+++ b/doc/source/development/release.md
@@ -0,0 +1,208 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Release
+
+## Principles
+
+The Apache Arrow Release follows the guidelines defined at the [Apache
+Software Foundation Release
+Policy](https://www.apache.org/legal/release-policy.html).
+
+## Prepare
+
+Some steps of the release require being a committer or a PMC member.
+
+- A GPG key in the Apache Web of Trust to sign artifacts. This will
+  have to be cross signed by other Apache committers/PMC members. You
+  must set your GPG key ID in `dev/release/.env` (see
+  `dev/release/.env.example` for a template).
+- The GPG key needs to be added to this [Subversion repository for
+  dev](https://dist.apache.org/repos/dist/dev/arrow/) and [Subversion
+  repository for
+  release](https://dist.apache.org/repos/dist/release/arrow/).
+- An [Artifactory](https://apache.jfrog.io) API key (log in with your
+  ASF credentials, then generate it from your profile in the
+  upper-right). You must set the Artifactory API key in
+  `dev/release/.env` (see `dev/release/.env.example` for a
+  template).
+- A GitHub personal access token that has at lease `workflow`
+  scope. You must set the GitHub personal access token in
+  `dev/release/.env` (see `dev/release/.env.example` for a template).
+- Clone [apache/arrow](https://github.com/apache/arrow) and prepare
+  `apache/arrow`'s `dev/release/.env` (see `dev/release/.env.example`
+  for a template) like `apache/arrow-flight-sql-postgresql`'s
+  `dev/release/.env`.
+
+## Create a RC
+
+Prepare a new RC when you create a first RC:
+
+```bash
+rake release:rc:prepare ARROW_SOURCE=/path/to/apache/arrow/repository/
+```
+
+You need to specify your cloned `apache/arrow` repository.
+
+This creates a `prepare-${VERSION}` branch on local repository. You
+need to push it and open a new pull request for it.
+
+Tag for a new RC after the pull request is merged:
+
+```bash
+rake release:rc:tag
+```
+
+This creates a new tag for the new RC. You check it and push to
+`apache/arrow-flight-sql-postgresql`.
+
+Artifacts for the new RC are built automatically on GitHub Actions.
+
+Sign these artifacts:
+
+```bash
+rake release:rc:sign
+```
+
+Note that you don't need to wait for finishing GitHub Actions jobs
+before you run the above command line. Because the above command line
+waits for finishing GitHub Actions jobs automatically.
+
+Upload Linux packages:
+
+```bash
+rake release:rc:linux ARROW_SOURCE=/path/to/apache/arrow/repository/
+```
+
+You need to specify your cloned `apache/arrow` repository. You must
+prepare its `dev/release/.env` (not only
+`apache/arrow-flight-sql-postgresql`'s `dev/release/.env`.)
+
+Start a vote thread for the new RC on `dev@arrow.apache.org`. You can
+generate a vote e-mail template:
+
+```bash
+rake release:vote
+```
+
+Approval requires a net of 3 +1 votes from PMC members. A release
+cannot be vetoed.
+
+## How to verify
+
+### Install dependencies
+
+At minimum, you will need:
+
+- Apache Arrow C++ (Apache Arrow Flight SQL must be enabled)
+- C++ compiler
+- Git
+- GnuPG
+- Meson
+- Ninja
+- PostgreSQL 15 or later
+- cURL
+- jq
+- shasum (built into macOS) or sha256sum/sha512sum (on Linux)
+
+### Verify
+
+Clone the project:
+
+```bash
+git clone https://github.com/apache/arrow-flight-sql-postgresql.git
+```
+
+Run the verification script:
+
+```bash
+cd arrow-flight-sql-postgresql
+# Pass the version and the RC number.
+# This stops after build is succeeded. You need to verify manually after it.
+# See "Hints" the script shows what you do.
+dev/release/verify-rc.sh 0.1.0 1
+```
+
+These environment variables may be helpful:
+
+- `ARROW_TMPDIR=/path/to/directory` to specify the temporary directory
+  used. Using a fixed directory can help avoid repeating the same
+  setup and build steps if the script has to be run multiple times.
+- `TEST_SOURCE_MANUAL=0` to disable manual verification.
+
+Once finished and once the script passes, reply to the mailing list
+vote thread with a `+1` or a `-1`.
+
+## Post-release tasks
+
+After the release vote, we must undertake the following tasks:
+
+Publish artifacts:
+
+```bash
+rake release:rc:publish ARROW_SOURCE=/path/to/apache/arrow/repository/
+```
+
+This command line opens [Apache
+reporter](https://reporter.apache.org/addrelease.html?arrow) by your
+Web browser. Don't forget to register the new release by the form in
+the page.
+
+This command line creates the tag for the new release but doesn't push
+it automatically by default. Don't forget to push it.
+
+Publish release blog post. The following command line generates the
+blog post outline, then fill out outline and create a PR on
+[`apache/arrow-site`](https://github.com/apache/arrow-site):
+
+```bash
+rake release:announce:blog PREVIOUS_VERSION=X.Y.Z
+```
+
+Announce the new release on mailing lists. The following command line
+generates the announce e-mail outline, then fill out outline and send
+the announce e-mail to `announce@apache.org`, `user@arrow.apache.org`
+and `dev@arrow.apache.org`. You must use your `@apache.org` e-mail
+address to send an e-mail to `announce@apache.org`:
+
+```bash
+rake release:announce:mail
+```
+
+Announce the new release on `pgsql-announce@postgresql.org`.
+
+You need to create your PostgreSQL community account:
+https://www.postgresql.org/account/
+
+You need to join the Apache Arrow organization on PostgreSQL community.
+TODO: Create it.
+
+The following command line generates the announce e-mail outline, then
+fill out outline and submit it to
+https://www.postgresql.org/account/edit/news/ :
+
+```bash
+rake release:announce:postgresql
+```
+
+Bump version:
+
+```bash
+rake version:bump NEW_VERSION=X.Y.Z
+```
diff --git a/doc/source/index.md b/doc/source/index.md
index ca70714..c161691 100644
--- a/doc/source/index.md
+++ b/doc/source/index.md
@@ -32,6 +32,12 @@ configuration.md
 client.md
 ```
 
+```{toctree}
+:maxdepth: 1
+:caption: For developers
+development/release.md
+```
+
 ## Indices and tables
 
 - {ref}`genindex`
diff --git a/doc/source/overview.md b/doc/source/overview.md
index 7d1521d..0722284 100644
--- a/doc/source/overview.md
+++ b/doc/source/overview.md
@@ -19,6 +19,8 @@
 
 # Overview
 
+## What is this?
+
 Apache Arrow Flight SQL adapter for PostgreSQL is a PostgreSQL
 extension that adds an [Apache Arrow Flight
 SQL][apache-arrow-flight-sql] endpoint to PostgreSQL.
@@ -34,6 +36,8 @@ you want to get large data by `SELECT` or `INSERT`/`UPDATE` large
 data, Apache Arrow Flight SQL will be faster than the PostgreSQL wire
 protocol.
 
+## Benchmark
+
 See also [a simple benchmark result][benchmark-integer] that just
 executes `SELECT * FROM integer_only_table`. It shows that Apache
 Arrow Flight SQL is faster than the PostgreSQL wire protocol when
diff --git a/doc/source/release-notes.md b/doc/source/release-notes.md
index 3f9dd1a..12a1387 100644
--- a/doc/source/release-notes.md
+++ b/doc/source/release-notes.md
@@ -19,7 +19,7 @@
 
 # Release notes
 
-## 0.1.0
+## Version 0.1.0
 
 ### Improvements
 
diff --git a/package/apt/test.sh b/package/apt/test.sh
index 99dd827..2cedaef 100755
--- a/package/apt/test.sh
+++ b/package/apt/test.sh
@@ -19,52 +19,117 @@
 
 set -eux
 
-relative_repositories_dir=$1
+if [ $# -lt 2 ]; then
+  echo "Usage: $0 VERSION rc"
+  echo "       $0 VERSION staging-rc"
+  echo "       $0 VERSION release"
+  echo "       $0 VERSION staging-release"
+  echo "       $0 VERSION local RELATIVE_REPOSITORIES_DIR"
+  echo " e.g.: $0 1.0.0 rc                # Verify 1.0.0 RC"
+  echo " e.g.: $0 1.0.0 staging-rc        # Verify 1.0.0 RC on staging"
+  echo " e.g.: $0 1.0.0 release           # Verify 1.0.0"
+  echo " e.g.: $0 1.0.0 staging-release   # Verify 1.0.0 on staging"
+  echo " e.g.: $0 1.0.0 local package/postgresql-15-pgdg/apt/repositories"
+  echo "       # Verify 1.0.0 on local"
+  exit 1
+fi
+
+VERSION="$1"
+TYPE="$2"
+if [ "${TYPE}" = "local" ]; then
+  RELATIVE_REPOSITORIES_DIR="$3"
+  REPOSITORIES_DIR=/host/${RELATIVE_REPOSITORIES_DIR}
+fi
+
+SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+TOP_SOURCE_DIR="${SOURCE_DIR}/../.."
 
 echo "::group::Prepare APT repositories"
 
 echo "debconf debconf/frontend select Noninteractive" | \
   debconf-set-selections
 
-apt update
-apt install -V -y \
-    lsb-release \
-    wget
-
-os=$(lsb_release --id --short | tr "A-Z" "a-z")
+retry() {
+  local n_tries=2
+  while [ ${n_tries} -gt 0 ]; do
+    if "$@"; then
+      return
+    fi
+    n_tries=$((${n_tries} - 1))
+  done
+  "$@"
+}
+
+APT_UPDATE="retry apt update --error-on=any"
+APT_INSTALL="retry apt install -y -V --no-install-recommends"
+
+${APT_UPDATE}
+${APT_INSTALL} \
+  ca-certificates \
+  gpg \
+  lsb-release \
+  wget
+
+distribution=$(lsb_release --id --short | tr "A-Z" "a-z")
 code_name=$(lsb_release --codename --short)
 architecture=$(dpkg --print-architecture)
 
-repositories_dir=/host/${relative_repositories_dir}
-wget https://apache.jfrog.io/artifactory/arrow/${os}/apache-arrow-apt-source-latest-${code_name}.deb
-apt install -V -y ./apache-arrow-apt-source-latest-${code_name}.deb
-
-echo "deb http://apt.postgresql.org/pub/repos/apt/ ${code_name}-pgdg main" | \
-  tee /etc/apt/sources.list.d/pgdg.list
-wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
-  apt-key add -
+artifactory_base_url="https://apache.jfrog.io/artifactory/arrow/${distribution}"
+case "${TYPE}" in
+  rc|staging-rc|staging-release)
+    suffix=${TYPE%-release}
+    artifactory_base_url+="-${suffix}"
+    ;;
+esac
+wget ${artifactory_base_url}/apache-arrow-apt-source-latest-${code_name}.deb
+${APT_INSTALL} ./apache-arrow-apt-source-latest-${code_name}.deb
+
+case "${TYPE}" in
+  rc|staging-rc|staging-release)
+    suffix=${TYPE%-release}
+    sed \
+      -i"" \
+      -e "s,^URIs: \\(.*\\)/,URIs: \\1-${suffix}/,g" \
+      /etc/apt/sources.list.d/apache-arrow.sources
+    ;;
+esac
+
+wget -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
+  gpg --no-default-keyring --keyring /usr/share/keyrings/pgdg.gpg --import -
+(echo "Types: deb"; \
+ echo "URIs: http://apt.postgresql.org/pub/repos/apt"; \
+ echo "Suites: ${code_name}-pgdg"; \
+ echo "Components: main"; \
+ echo "Signed-By: /usr/share/keyrings/pgdg.gpg") | \
+  tee /etc/apt/sources.list.d/pgdg.sources
 
 echo "::endgroup::"
 
 
 echo "::group::Install built packages"
 
-apt update
+${APT_UPDATE}
 
-apt install -V -y \
-  ${repositories_dir}/${os}/pool/${code_name}/*/*/*/*_${architecture}.deb
+package=postgresql-15-pgdg-apache-arrow-flight-sql
+package_version=${VERSION}-1
+if [ "${TYPE}" = "local" ]; then
+  ${APT_INSTALL} \
+    ${REPOSITORIES_DIR}/${distribution}/pool/${code_name}/*/*/*/${package}_${package_version}_${architecture}.deb
+else
+  ${APT_INSTALL} postgresql-15-pgdg-apache-arrow-flight-sql=${package_version}
+fi
 
 echo "::endgroup::"
 
 
 echo "::group::Install packages for test"
 
-apt install -V -y \
-    g++ \
-    libarrow-flight-sql-glib-dev \
-    make \
-    ruby-dev \
-    sudo
+${APT_INSTALL} \
+  g++ \
+  libarrow-flight-sql-glib-dev \
+  make \
+  ruby-dev \
+  sudo
 MAKELAGS="-j$(nproc)" \
         gem install \
         red-arrow-flight-sql \