-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(await-maven-artifact): migrate from https:/elastic/a…
- Loading branch information
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: test-maven-await-artifact | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'maven/await-artifact/**' | ||
- '.github/workflows/test-maven-await-artifact.yml' | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'maven/await-artifact/**' | ||
- '.github/workflows/test-maven-await-artifact.yml' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./maven/await-artifact | ||
timeout-minutes: 1 | ||
with: | ||
artifact-id: "elastic-apm-agent" | ||
group-id: "co.elastic.apm" | ||
version: "1.50.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# <!--name-->maven/await-artifact<!--/name--> | ||
|
||
[![usages](https://img.shields.io/badge/usages-white?logo=githubactions&logoColor=blue)](https:/search?q=elastic%2Foblt-actions%2Fmaven%2Fawait-artifact+%28path%3A.github%2Fworkflows+OR+path%3A**%2Faction.yml+OR+path%3A**%2Faction.yaml%29&type=code) | ||
[![test-maven-await-artifact](https:/elastic/oblt-actions/actions/workflows/test-elastic-active-branches.yml/badge.svg?branch=main)](https:/elastic/oblt-actions/actions/workflows/test-maven-await-artifact.yml) | ||
|
||
<!--description--> | ||
Waits for an artifact to be available on maven central | ||
<!--/description--> | ||
|
||
NOTE: this action does not timeout, hence you need to configure your GitHub workflow accordingly. | ||
See https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepstimeout-minutes | ||
|
||
## Inputs | ||
<!--inputs--> | ||
| Name | Description | Required | Default | | ||
|---------------|-------------------------------------|----------|---------| | ||
| `artifact-id` | Maven artifact-ID of the artifact | `true` | ` ` | | ||
| `group-id` | Maven group-ID of the artifact | `true` | ` ` | | ||
| `version` | Version of the artifact to wait for | `true` | ` ` | | ||
<!--/inputs--> | ||
|
||
|
||
## Usage | ||
|
||
<!--usage action="elastic/oblt-actions/**" version="env:VERSION"--> | ||
```yaml | ||
name: release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'The version to release (e.g. 1.2.3). This workflow will automatically perform the required version bumps' | ||
required: true | ||
jobs: | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# ... | ||
- uses: elastic/oblt-actions/maven/await-artifact@v1 | ||
timeout-minutes: 10 | ||
with: | ||
group-id: "co.elastic.apm" | ||
artifact-id: "apm-agent-java" | ||
version: "${{ inputs.version }}" | ||
# ... | ||
``` | ||
<!--/usage--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: maven/await-artifact | ||
description: | | ||
Waits for an artifact to be available on maven central | ||
inputs: | ||
artifact-id: | ||
description: 'Maven artifact-ID of the artifact' | ||
required: true | ||
group-id: | ||
description: 'Maven group-ID of the artifact' | ||
required: true | ||
version: | ||
description: 'Version of the artifact to wait for' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Wait for artifact to be available on maven central | ||
shell: bash | ||
run: | | ||
full_url="https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=${GROUP_ID}&a=${ARTIFACT_ID}&v=${VERSION}" | ||
until curl -fs -I -L "${full_url}" > /dev/null | ||
do | ||
echo "Artifact ${GROUP_ID}:${ARTIFACT_ID}:${VERSION} not found on maven central. Sleeping 30 seconds, retrying afterwards" | ||
sleep 30s | ||
done | ||
env: | ||
ARTIFACT_ID: ${{ inputs.artifact-id }} | ||
GROUP_ID: ${{ inputs.group-id }} | ||
VERSION: ${{ inputs.version }} |