Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(await-maven-artifact): migrate from https:/elastic/apm-pipeline-library #118

Merged
merged 4 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/test-maven-await-artifact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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
timeout-minutes: 1
steps:
- uses: actions/checkout@v4
- uses: ./maven/await-artifact
id: aws-auth
continue-on-error: true
with:
artifact-id: "elastic-apm-agent"
group-id: "co.elastic.apm"
version: "1.50.0"
45 changes: 45 additions & 0 deletions maven/await-artifact/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# <!--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-->

## 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
with:
group-id: "co.elastic.apm"
artifact-id: "apm-agent-java"
version: "${{ inputs.version }}"

# ...
```
<!--/usage-->
29 changes: 29 additions & 0 deletions maven/await-artifact/action.yml
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
v1v marked this conversation as resolved.
Show resolved Hide resolved
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 }}
Loading