-
Notifications
You must be signed in to change notification settings - Fork 24
142 lines (130 loc) · 6.28 KB
/
publish.yml
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Publish
on:
issues:
types: [labeled]
jobs:
publish:
runs-on: ubuntu-latest
name: Publish a new version
if: github.event.label.name == 'accepted' && github.event.issue.state == 'open'
timeout-minutes: 90
env:
SENTRY_DSN: "https://[email protected]/6183838"
steps:
- name: Get repo contents
uses: actions/checkout@v3
with:
path: .__publish__
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 14
cache: yarn
cache-dependency-path: .__publish__/yarn.lock
- name: Install yarn dependencies
run: yarn install --cwd ".__publish__"
- name: Parse and set inputs
id: inputs
run: node .__publish__/src/publish/inputs.js
- name: Inform start
if: steps.inputs.outcome == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node .__publish__/src/publish/post-workflow-details.js
# Setting the target repo branch will cause the craft config (.craft.yml) to be taken from the checked out branch
# By default, we check out the default branch of the repo.
# If you need to maintain diverging craft configs on different branches, add your repo and the merge target branch
# (i.e. the branch craft will merge the release branch into) into the if condition below.
- name: Set target repo checkout branch
# Note: Branches registered here MUST BE protected in the target repo!
if: |
fromJSON(steps.inputs.outputs.result).repo == 'sentry-migr8' && fromJSON(steps.inputs.outputs.result).merge_target == 'tmp-merge-target' ||
fromJSON(steps.inputs.outputs.result).repo == 'sentry-javascript' && fromJSON(steps.inputs.outputs.result).merge_target == 'v7' ||
fromJSON(steps.inputs.outputs.result).repo == 'sentry-javascript' && fromJSON(steps.inputs.outputs.result).merge_target == 'master' ||
fromJSON(steps.inputs.outputs.result).repo == 'sentry-wizard' && fromJSON(steps.inputs.outputs.result).merge_target == '1.x' ||
false
id: target-repo-branch
run: |
echo 'taking craft config from branch ${{ fromJSON(steps.inputs.outputs.result).merge_target }} in ${{ fromJSON(steps.inputs.outputs.result).repo }}'
echo 'target_repo_branch=${{ fromJSON(steps.inputs.outputs.result).merge_target }}' >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v3
name: Check out target repo
if: ${{ steps.inputs.outputs.result }}
with:
path: __repo__
ref: ${{ steps.target-repo-branch.outputs.target_repo_branch || ''}}
repository: getsentry/${{ fromJSON(steps.inputs.outputs.result).repo }}
token: ${{ secrets.GH_SENTRY_BOT_PAT }}
fetch-depth: 0
- name: Set targets
shell: bash
if: fromJSON(steps.inputs.outputs.result).targets
run: >
jq -n --argjson
source '${{ toJSON(fromJSON(steps.inputs.outputs.result).targets) }}'
'[{($source[]): true }] | add | {"published": (. // {}) }'
> __repo__/${{ fromJSON(steps.inputs.outputs.result).path }}/.craft-publish-${{ fromJSON(steps.inputs.outputs.result).version }}.json
- uses: docker://getsentry/craft:latest
name: Publish using Craft
with:
entrypoint: /bin/bash
args: >-
-e
-c "
export HOME=/root &&
cd __repo__/${{ fromJSON(steps.inputs.outputs.result).path }} &&
exec craft publish ${{ fromJSON(steps.inputs.outputs.result).version }}
"
env:
CRAFT_MERGE_TARGET: ${{ fromJSON(steps.inputs.outputs.result).merge_target }}
CRAFT_LOG_LEVEL: ${{ secrets.CRAFT_LOG_LEVEL }}
CRAFT_DRY_RUN: ${{ fromJSON(steps.inputs.outputs.result).dry_run }}
GIT_COMMITTER_NAME: getsentry-bot
GIT_AUTHOR_NAME: getsentry-bot
EMAIL: [email protected]
GITHUB_API_TOKEN: ${{ secrets.GH_SENTRY_BOT_PAT }}
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
CRAFT_GCS_TARGET_CREDS_JSON: ${{ secrets.CRAFT_GCS_TARGET_CREDS_JSON }}
CRAFT_GCS_STORE_CREDS_JSON: ${{ secrets.CRAFT_GCS_STORE_CREDS_JSON }}
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
DOCKER_USERNAME: sentrybuilder
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
NUGET_API_TOKEN: ${{ secrets.NUGET_API_TOKEN }}
POWERSHELL_API_KEY: ${{ secrets.POWERSHELL_API_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
PUBDEV_ACCESS_TOKEN: ${{ secrets.PUBDEV_ACCESS_TOKEN }}
PUBDEV_REFRESH_TOKEN: ${{ secrets.PUBDEV_REFRESH_TOKEN }}
- name: Update completed targets and remove label
if: ${{ cancelled() || failure() }}
env:
PUBLISH_ARGS: ${{ steps.inputs.outputs.result }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node .__publish__/src/publish/update-issue.js
- name: Inform about cancellation
if: ${{ cancelled() }}
env:
PUBLISH_ARGS: ${{ steps.inputs.outputs.result }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node .__publish__/src/publish/post-result.js cancelled
- name: Inform about failure
if: ${{ failure() }}
env:
PUBLISH_ARGS: ${{ steps.inputs.outputs.result }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node .__publish__/src/publish/post-result.js failure
- name: Close on success
if: ${{ success() }}
env:
PUBLISH_ARGS: ${{ steps.inputs.outputs.result }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node .__publish__/src/publish/post-result.js success