Skip to content

Commit

Permalink
Improve workflow: fetch release id automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
hakuzumon committed Feb 20, 2024
1 parent e088850 commit 6476d8a
Showing 1 changed file with 36 additions and 37 deletions.
73 changes: 36 additions & 37 deletions .github/workflows/add-release-archive.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
# Add a zip built for new ES-version to existing release
name: Add release archive
on:
workflow_dispatch:
inputs:
# TODO: detect this automatically from tag name
releaseId:
required: true
type: string
description: "Id of the release to update"
releaseVersion:
required: true
type: string
description: "Release version to checkout"
elasticsearchVersion:
required: true
type: string
description: "Version of target Elasticsearch"
workflow_dispatch:
inputs:
releaseVersion:
required: true
type: string
description: "Release version to checkout"
elasticsearchVersion:
required: true
type: string
description: "Version of target Elasticsearch"

# version: ${{ github.event.inputs.version }}
jobs:
# TODO: duplication from build.yaml
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: v${{ github.event.inputs.releaseVersion }}
- uses: actions/setup-java@v1
with:
java-version: 8
- uses: gradle/wrapper-validation-action@v1
- uses: gradle/gradle-build-action@v2
with:
arguments: build -DbaseVersion=${{ github.event.inputs.releaseVersion }} -DelasticsearchVersion=${{ github.event.inputs.elasticsearchVersion }}
- name: Upload the artifacts
uses: skx/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ github.event.inputs.releaseId }}
args: 'build/distributions/*.zip'
# TODO: duplication from build.yaml
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: v${{ github.event.inputs.releaseVersion }}
- uses: actions/setup-java@v1
with:
java-version: 8
- uses: gradle/wrapper-validation-action@v1
- uses: gradle/gradle-build-action@v2
with:
arguments: build -DbaseVersion=${{ github.event.inputs.releaseVersion }} -DelasticsearchVersion=${{ github.event.inputs.elasticsearchVersion }}
- name: Get release ID
id: get_release_id
run: |
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')
echo "::set-output name=releaseId::$release_id"
- name: Upload the artifacts
uses: skx/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ steps.get_release_id.outputs.releaseId }}
args: 'build/distributions/*.zip'

0 comments on commit 6476d8a

Please sign in to comment.