-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (89 loc) · 3.38 KB
/
pre-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: CI
on:
push:
branches: [main]
pull_request:
branches: ["**"]
workflow_call:
permissions:
contents: read
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
versions:
name: Determine versions
runs-on: ubuntu-24.04
env:
RELEASE_VERSION: ${{ (github.ref_name == 'main' && 'dev') || (github.event_name != 'pull_request' && github.ref_name) || github.head_ref }}
outputs:
go-version: ${{ steps.go-version.outputs.version }}
profiler-version: ${{ steps.profiler-version.outputs.version }}
steps:
- name: Check out
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Get Go version from go.mod file
id: go-version
run: echo "version=$(go mod edit -json | jq -r .Go)" >> "${GITHUB_OUTPUT}"
- name: Compute profiler version
id: profiler-version
run: echo "version=${RELEASE_VERSION}-${GITHUB_SHA::7}.${{ github.run_id }}" >> "${GITHUB_OUTPUT}"
build:
name: Build
needs: [versions]
uses: ./.github/workflows/build.yml
with:
go-version: ${{ needs.versions.outputs.go-version }}
profiler-version: ${{ needs.versions.outputs.profiler-version }}
secrets: inherit
permissions:
contents: read
pull-requests: write
publish:
env:
RELEASE_VERSION: ${{ github.event_name == 'pull_request' && 'dev-test' || 'dev' }}
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'publish-dev-test') )}}
name: Publish pre-release
needs: [build]
runs-on: ubuntu-24.04
permissions:
contents: write
packages: write
steps:
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
- name: Create assets
run: |
tar czf dd-otel-host-profiler-${RELEASE_VERSION}-aarch64.tar.gz -C agent-aarch64 .
tar czf dd-otel-host-profiler-${RELEASE_VERSION}-x86_64.tar.gz -C agent-x86_64 .
sha256sum dd-otel-host-profiler-${RELEASE_VERSION}-aarch64.tar.gz dd-otel-host-profiler-${RELEASE_VERSION}-x86_64.tar.gz > sha256sums.txt
- name: Create or move previous dev tag
continue-on-error: true
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ env.RELEASE_VERSION }}',
sha: context.sha
}).catch(err => {
if (err.status !== 422) throw err;
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/${{ env.RELEASE_VERSION }}',
sha: context.sha
})
});
- name: Create pre-release
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
with:
artifacts: "dd-otel-host-profiler-${{ env.RELEASE_VERSION }}-*.tar.gz,sha256sums.txt"
allowUpdates: true
removeArtifacts: true
omitBody: true
omitDraftDuringUpdate: true
prerelease: true
draft: false
tag: ${{ env.RELEASE_VERSION }}