Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/actions/setup-release-environment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'Setup Release Environment'
runs:
using: "composite"
steps:
- name: Install gh cli
shell: bash
run: |
# https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt
(type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& sudo mkdir -p -m 755 /etc/apt/sources.list.d \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y

- name: Set working directory owner
shell: bash
run: chown root:root .

- name: Configure Git
shell: bash
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Bundler cache
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gem-

- name: Setup gems
shell: bash
run: |
bundle config --local path vendor/bundle
bundle config --local deployment true
bundle config --local without development
bundle install --jobs 4
bundle clean
49 changes: 49 additions & 0 deletions .github/workflows/release-handler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release - create tags & branches

on:
workflow_dispatch:
inputs:
sha:
description: "The commit SHA to prepare the release for"
required: false
type: string
push:
branches:
- main
- release/*
paths:
- "lib/version.rb"

permissions:
contents: write
pull-requests: write
actions: write

jobs:
build:
name: run
runs-on: ubuntu-latest
container: discourse/discourse_test:slim
timeout-minutes: 10

steps:
- uses: actions/checkout@v6
with:
filter: tree:0
fetch-depth: 0

- uses: ./.github/actions/setup-release-environment

- name: Maybe cut branch
id: maybe-cut-branch
if: github.ref == 'refs/heads/main'
run: bin/rake release:maybe_cut_branch[${{ inputs.sha || github.sha }}]

- name: Maybe trigger prepare next version
if: steps.maybe-cut-branch.outputs.new_branch_name
run: gh workflow run release-prepare-bump.yml -f branch="version-bump/${{ steps.maybe-cut-branch.outputs.new_branch_name }}"
env:
GH_TOKEN: ${{ github.token }}

- name: Maybe tag release
run: bin/rake release:maybe_tag_release[${{ inputs.sha || github.sha }}]
39 changes: 39 additions & 0 deletions .github/workflows/release-prepare-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release - prepare bump on release branch

on:
workflow_dispatch:
inputs:
branch:
description: "The release branch to prepare the next version for, e.g. `release/2015.11`"
required: true
type: string
push:
branches:
- release/*
paths-ignore: # a version bump on a release branch should not trigger another version bump PR
- 'lib/version.rb'

permissions:
contents: write
pull-requests: write

jobs:
build:
name: run
runs-on: ubuntu-latest
container: discourse/discourse_test:slim
timeout-minutes: 10

env:
GH_TOKEN: ${{ github.token }}

steps:
- uses: actions/checkout@v6
with:
filter: tree:0
fetch-depth: 0

- uses: ./.github/actions/setup-release-environment

- name: Create a PR for the next version bump
run: bin/rake "release:prepare_next_version_branch[${{ inputs.branch || github.ref_name }}]"
29 changes: 29 additions & 0 deletions .github/workflows/release-prepare-latest-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release - prepare bump for main branch

on:
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
build:
name: run
runs-on: ubuntu-latest
container: discourse/discourse_test:slim
timeout-minutes: 10

env:
GH_TOKEN: ${{ github.token }}

steps:
- uses: actions/checkout@v6
with:
filter: tree:0
fetch-depth: 0

- uses: ./.github/actions/setup-release-environment

- name: Create a PR for the next version bump
run: bin/rake release:prepare_next_version
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
echo "QUNIT_PARALLEL=$(($(nproc) / 2))" >> $GITHUB_ENV
fi

- uses: actions/checkout@v6
- uses: actions/checkout@v5
with:
fetch-depth: 1

Expand Down
Loading
Loading