-
Notifications
You must be signed in to change notification settings - Fork 24
97 lines (91 loc) · 3.77 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
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'
steps:
- name: "Get repo contents"
uses: actions/checkout@v2
with:
path: ".__publish__"
- name: "Parse and set inputs"
id: inputs
uses: actions/github-script@v3
with:
script: |
const inputs = require(`${process.env.GITHUB_WORKSPACE}/.__publish__/src/publish/inputs.js`).default;
return await inputs({context});
- name: "Inform start"
if: steps.inputs.outcome == 'success'
uses: actions/github-script@v3
with:
script: |
const start = require(`${process.env.GITHUB_WORKSPACE}/.__publish__/src/publish/start.js`).default;
return await start({context, github});
- uses: actions/checkout@v2
name: Check out target repo
if: ${{ steps.inputs.outputs.result }}
with:
path: "__repo__"
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__/.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 "
cd __repo__/${{ fromJSON(steps.inputs.outputs.result).path }};
exec craft publish ${{ fromJSON(steps.inputs.outputs.result).version }};
"
env:
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 }}
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 }}
- name: Inform about failure
if: ${{ failure() }}
uses: actions/github-script@v3
env:
PUBLISH_ARGS: ${{ steps.inputs.outputs.result }}
with:
script: |
const inputs = JSON.parse(process.env.PUBLISH_ARGS);
const fail = require(`${process.env.GITHUB_WORKSPACE}/.__publish__/src/publish/fail.js`).default;
return await fail({context, github, inputs});
- name: Close on success
if: ${{ success() }}
uses: actions/github-script@v3
with:
script: |
const success = require(`${process.env.GITHUB_WORKSPACE}/.__publish__/src/publish/success.js`).default;
return await success({context, github});