Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

action: post-release steps #2201

Merged
merged 8 commits into from
Oct 19, 2023
Merged
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
11 changes: 8 additions & 3 deletions .github/workflows/bootstrap/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ outputs:
agent-version:
description: "The current agent version number"
value: ${{ steps.dotnet.outputs.agent-version }}
major-version:
description: "The current major version number, semver"
value: ${{ steps.dotnet.outputs.major-version }}

runs:
using: "composite"
Expand Down Expand Up @@ -48,9 +51,11 @@ runs:
run: |
dotnet --list-sdks
dotnet tool restore
echo "Version Number: $(dotnet minver -t=v -p=canary.0 -v=e)"
echo "AGENT_VERSION=$(dotnet minver -t=v -p=canary.0 -v=e)" >> $GITHUB_ENV
echo "agent-version=$(dotnet minver -t=v -p=canary.0 -v=e)" >> $GITHUB_OUTPUT
AGENT_VERSION=$(dotnet minver -t=v -p=canary.0 -v=e)
echo "Version Number: ${AGENT_VERSION}"
echo "AGENT_VERSION=${AGENT_VERSION}" >> $GITHUB_ENV
echo "agent-version=${AGENT_VERSION}" >> $GITHUB_OUTPUT
Mpdreamz marked this conversation as resolved.
Show resolved Hide resolved
echo "major-version=$(echo ${AGENT_VERSION} | cut -d"." -f1)" >> $GITHUB_OUTPUT


# Setup git config
Expand Down
57 changes: 53 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ permissions:

env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
SLACK_CHANNEL: "#apm-agent-dotnet"
Mpdreamz marked this conversation as resolved.
Show resolved Hide resolved

jobs:
release:
Expand Down Expand Up @@ -71,10 +73,10 @@ jobs:
url: ${{ secrets.VAULT_ADDR }}
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
channel: "#apm-agent-dotnet"
channel: ${{ env.SLACK_CHANNEL }}
message: |
:large_green_circle: [${{ github.repository }}] Release *${{ github.ref_name }}* published.
Build: (<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>)
Build: (<${{ env.JOB_URL }}|here>)
Mpdreamz marked this conversation as resolved.
Show resolved Hide resolved
Release URL: (<https://github.com/elastic/apm-agent-dotnet/releases/tag/${{ github.ref_name }}|${{ github.ref_name }}>)"

- if: ${{ failure() }}
Expand All @@ -83,18 +85,22 @@ jobs:
url: ${{ secrets.VAULT_ADDR }}
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
channel: "#apm-agent-dotnet"
channel: ${{ env.SLACK_CHANNEL }}
message: |
:large_yellow_circle: [${{ github.repository }}] Release *${{ github.ref_name }}* could not be published.
Build: (<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>)
Build: (<${{ env.JOB_URL }}|here>)
Mpdreamz marked this conversation as resolved.
Show resolved Hide resolved

release-windows:
runs-on: windows-2022
needs: [ 'release']
outputs:
agent-version: ${{ steps.bootstrap.outputs.agent-version }}
major-version: ${{ steps.bootstrap.outputs.major-version }}

steps:
- uses: actions/checkout@v3
- name: Bootstrap Action Workspace
id: bootstrap
uses: ./.github/workflows/bootstrap
with:
rust: 'true'
Expand All @@ -108,3 +114,46 @@ jobs:
continue-on-error: true #continue for now until we see it working in action
run: |
gh release upload ${{ github.ref_name }} "build/output/elastic_apm_profiler_*.zip"

post-release:
needs: [ 'release-windows']
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_TAG: v${{ needs.release-windows.outputs.agent-version }}
NEW_BRANCH: update/${{ needs.release-windows.outputs.agent-version }}
TARGET_BRANCH: ${{ needs.release-windows.outputs.major-version }}.x

steps:
- uses: actions/checkout@v4
with:
depth: 0

- name: Create GitHub Pull Request if minor release.
run: |
echo "as long as there is a major.x branch"
existed_in_local=$(git ls-remote --heads origin ${TARGET_BRANCH})
if [ -z ${existed_in_local} ]; then
echo -e "::warning::Target branch '${TARGET_BRANCH}' does not exist."
exit 0
fi
git checkout ${TARGET_BRANCH} -b ${NEW_BRANCH}
git format-patch -k --stdout ${TARGET_BRANCH}...main -- docs CHANGELOG.asciidoc | git am -3 -k
git push origin ${NEW_BRANCH}
gh pr create \
--title "post-release: ${GIT_TAG}" \
--body "Generated automatically with ${JOB_URL}" \
--head "elastic:${NEW_BRANCH}" \
--base "$TARGET_BRANCH" \
--repo "${{ github.repository }}"

- name: Create branch if major release
run: |
echo "as long as there is no a major.x branch"
existed_in_local=$(git ls-remote --heads origin ${TARGET_BRANCH})
if [ -n ${existed_in_local} ]; then
echo -e "::warning::Target branch '${TARGET_BRANCH}' does exist."
exit 0
fi
git branch -D $TARGET_BRANCH
git push origin $TARGET_BRANCH
7 changes: 6 additions & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ Creating a release will trigger the [release Github Action](.github/workflows/re

### Attaching files on GitHub

> **NOTE**: The steps below are now automated with GitHub actions.

We attach 2 files to the release on GitHub:
- `ElasticApmAgent_<major>.<minor>.<bug>(-<suffix>)?.zip`: This is the startup-hook based agent.
- `elastic_apm_profiler_<major>.<minor>.<bug>(-<suffix>)?.zip`: This is the profiler-based agent. The CI currently generates 2 profiler zip files, one for Windows (with `libelastic_apm_profiler.dll`), and one for Linux (with `libelastic_apm_profiler.so`). The only difference in the zip files is the native agent, the remaining files are the same. We copy the 2 native files into a folder with the remaining files and zip that folder as `elastic_apm_profiler_<major>.<minor>.<bug>(-<suffix>)?.zip` which we attach to the release.

The steps above are now automated.

### Updating the documentation

> **NOTE**: The steps below are now automated with GitHub actions.

Each major version has a `<major>.x` branch in the repository (e.g. for major version `1` we have the branch `1.x`).

In case of minor and patch releases we just need to update the `<major>.x` branch to the currently released tag:
Expand All @@ -65,6 +68,8 @@ git push --force upstream 1.x

In case of a major release, we need to create the `<major>.x` branch from the currently released tag and push the new `<major>.x` branch.

#### For a major release

Additionally, in case of a major version release, we need to create a PR in [elastic/docs](https://github.com/elastic/docs).

In this PR we need to update:
Expand Down
Loading