Skip to content

Commit 6476d8a

Browse files
committed
Improve workflow: fetch release id automatically
1 parent e088850 commit 6476d8a

File tree

1 file changed

+36
-37
lines changed

1 file changed

+36
-37
lines changed
+36-37
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,41 @@
11
# Add a zip built for new ES-version to existing release
22
name: Add release archive
33
on:
4-
workflow_dispatch:
5-
inputs:
6-
# TODO: detect this automatically from tag name
7-
releaseId:
8-
required: true
9-
type: string
10-
description: "Id of the release to update"
11-
releaseVersion:
12-
required: true
13-
type: string
14-
description: "Release version to checkout"
15-
elasticsearchVersion:
16-
required: true
17-
type: string
18-
description: "Version of target Elasticsearch"
4+
workflow_dispatch:
5+
inputs:
6+
releaseVersion:
7+
required: true
8+
type: string
9+
description: "Release version to checkout"
10+
elasticsearchVersion:
11+
required: true
12+
type: string
13+
description: "Version of target Elasticsearch"
1914

20-
# version: ${{ github.event.inputs.version }}
2115
jobs:
22-
# TODO: duplication from build.yaml
23-
build:
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@v2
27-
with:
28-
ref: v${{ github.event.inputs.releaseVersion }}
29-
- uses: actions/setup-java@v1
30-
with:
31-
java-version: 8
32-
- uses: gradle/wrapper-validation-action@v1
33-
- uses: gradle/gradle-build-action@v2
34-
with:
35-
arguments: build -DbaseVersion=${{ github.event.inputs.releaseVersion }} -DelasticsearchVersion=${{ github.event.inputs.elasticsearchVersion }}
36-
- name: Upload the artifacts
37-
uses: skx/github-action-publish-binaries@release-2.0
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
with:
41-
releaseId: ${{ github.event.inputs.releaseId }}
42-
args: 'build/distributions/*.zip'
16+
# TODO: duplication from build.yaml
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
with:
22+
ref: v${{ github.event.inputs.releaseVersion }}
23+
- uses: actions/setup-java@v1
24+
with:
25+
java-version: 8
26+
- uses: gradle/wrapper-validation-action@v1
27+
- uses: gradle/gradle-build-action@v2
28+
with:
29+
arguments: build -DbaseVersion=${{ github.event.inputs.releaseVersion }} -DelasticsearchVersion=${{ github.event.inputs.elasticsearchVersion }}
30+
- name: Get release ID
31+
id: get_release_id
32+
run: |
33+
release_id=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/tags/v${{ github.event.inputs.releaseVersion }} | jq -r '.id')
34+
echo "::set-output name=releaseId::$release_id"
35+
- name: Upload the artifacts
36+
uses: skx/github-action-publish-binaries@release-2.0
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
with:
40+
releaseId: ${{ steps.get_release_id.outputs.releaseId }}
41+
args: 'build/distributions/*.zip'

0 commit comments

Comments
 (0)