v1.25.3 #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
release: | |
types: [published] | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
env: | |
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | |
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
SLACK_CHANNEL: "#apm-agent-dotnet" | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bootstrap Action Workspace | |
id: bootstrap | |
uses: ./.github/workflows/bootstrap | |
with: | |
rust: 'true' | |
- name: Package | |
run: ./build.sh pack | |
- name: Prepare Nuget | |
uses: hashicorp/[email protected] | |
with: | |
url: ${{ secrets.VAULT_ADDR }} | |
method: approle | |
roleId: ${{ secrets.VAULT_ROLE_ID }} | |
secretId: ${{ secrets.VAULT_SECRET_ID }} | |
secrets: | | |
secret/apm-team/ci/elastic-observability-nuget apiKey | REPO_API_KEY ; | |
secret/apm-team/ci/elastic-observability-nuget url | REPO_API_URL | |
- name: Release to Nuget | |
run: .ci/linux/deploy.sh ${REPO_API_KEY} ${REPO_API_URL} | |
- uses: elastic/apm-pipeline-library/.github/actions/docker-login@current | |
with: | |
registry: docker.elastic.co | |
secret: secret/observability-team/ci/docker-registry/prod | |
url: ${{ secrets.VAULT_ADDR }} | |
roleId: ${{ secrets.VAULT_ROLE_ID }} | |
secretId: ${{ secrets.VAULT_SECRET_ID }} | |
- name: Build Profiler Docker Image | |
continue-on-error: true #continue for now until we see it working in action | |
run: | | |
docker build . -t docker.elastic.co/observability/apm-agent-dotnet:${{ steps.bootstrap.outputs.agent-version }} \ | |
--build-arg AGENT_ZIP_FILE=build/output/elastic_apm_profiler_${{ steps.bootstrap.outputs.agent-version }}-linux-x64.zip | |
- name: Push Profiler Docker Image | |
continue-on-error: true #continue for now until we see it working in action | |
run: | | |
for i in $(seq 1 3); do [ $i -gt 1 ] && sleep 15; docker push docker.elastic.co/observability/apm-agent-dotnet:${{ steps.bootstrap.outputs.agent-version }} && s=0 && break || s=$?; done; (exit $s) | |
- name: Attach Profiler And Startup Hooks | |
continue-on-error: true #continue for now until we see it working in action | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release upload ${{ github.ref_name }} "build/output/ElasticApmAgent_${{ steps.bootstrap.outputs.agent-version }}.zip" "build/output/elastic_apm_profiler_${{ steps.bootstrap.outputs.agent-version }}-linux-x64.zip" | |
- if: ${{ success() }} | |
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current | |
with: | |
url: ${{ secrets.VAULT_ADDR }} | |
roleId: ${{ secrets.VAULT_ROLE_ID }} | |
secretId: ${{ secrets.VAULT_SECRET_ID }} | |
channel: ${{ env.SLACK_CHANNEL }} | |
message: | | |
:large_green_circle: [${{ github.repository }}] Release *${{ github.ref_name }}* published. | |
Build: (<${{ env.JOB_URL }}|here>) | |
Release URL: (<https://github.com/elastic/apm-agent-dotnet/releases/tag/${{ github.ref_name }}|${{ github.ref_name }}>) | |
- if: ${{ failure() }} | |
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current | |
with: | |
url: ${{ secrets.VAULT_ADDR }} | |
roleId: ${{ secrets.VAULT_ROLE_ID }} | |
secretId: ${{ secrets.VAULT_SECRET_ID }} | |
channel: ${{ env.SLACK_CHANNEL }} | |
message: | | |
:large_yellow_circle: [${{ github.repository }}] Release *${{ github.ref_name }}* could not be published. | |
Build: (<${{ env.JOB_URL }}|here>) | |
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@v4 | |
- name: Bootstrap Action Workspace | |
id: bootstrap | |
uses: ./.github/workflows/bootstrap | |
with: | |
rust: 'true' | |
- name: Build profiler | |
run: ./build.bat profiler-zip | |
- name: Attach Profiler | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
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_${{ steps.bootstrap.outputs.agent-version }}-win-x64.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: | |
fetch-depth: 0 | |
- name: Setup git config | |
uses: elastic/apm-pipeline-library/.github/actions/setup-git@current | |
- 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 | |
git checkout -b ${NEW_BRANCH} | |
git format-patch -k --stdout ${TARGET_BRANCH}...origin/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 |