Bump upload-artifact to v4 (#400) #262
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
--- | |
name: snapshot | |
on: | |
push: | |
branches: | |
- "main" | |
workflow_dispatch: | |
inputs: | |
dry_run: | |
description: If set, run a dry-run snapshot | |
default: false | |
type: boolean | |
permissions: | |
contents: read | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
outputs: | |
is-snapshot: ${{ steps.validate-step.outputs.is-snapshot }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Warmup gradle wrapper | |
uses: ./.github/workflows/gradle-goal | |
with: | |
command: "./gradlew -q currentVersion" | |
- name: Validate version is a snapshot version | |
id: validate-step | |
run: | | |
output=false | |
if [[ "$(./gradlew -q currentVersion)" =~ "-SNAPSHOT" ]]; then | |
echo "This is a snapshot version" | |
output=true | |
fi | |
echo "is-snapshot=${output}" >> "$GITHUB_OUTPUT" | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: | |
- validate | |
permissions: | |
attestations: write | |
contents: write | |
id-token: write | |
env: | |
TARBALL_FILE: artifacts.tar | |
if: ${{ contains(needs.validate.outputs.is-snapshot, 'true') }} | |
steps: | |
- id: buildkite-run | |
name: Run Deploy | |
uses: elastic/oblt-actions/buildkite/run@v1 | |
with: | |
commit: ${{ github.ref_name }} | |
pipeline: "elastic-otel-java-snapshot" | |
token: ${{ secrets.BUILDKITE_TOKEN }} | |
wait-for: true | |
env-vars: | | |
dry_run=${{ inputs.dry_run || 'false' }} | |
TARBALL_FILE=${{ env.TARBALL_FILE }} | |
- uses: elastic/oblt-actions/buildkite/download-artifact@v1 | |
with: | |
build-number: ${{ steps.buildkite-run.outputs.number }} | |
path: ${{ env.TARBALL_FILE }} | |
pipeline: ${{ steps.buildkite-run.outputs.pipeline }} | |
token: ${{ secrets.BUILDKITE_TOKEN }} | |
- name: untar the buildkite tarball | |
run: tar xvf ${{ env.TARBALL_FILE }} | |
- name: generate build provenance | |
uses: actions/attest-build-provenance@6149ea5740be74af77f260b9db67e633f6b0a9a1 # v1.4.2 | |
with: | |
subject-path: "${{ github.workspace }}/**/*.jar" | |
- if: ${{ failure() }} | |
uses: elastic/oblt-actions/slack/send@v1 | |
with: | |
bot-token: ${{ secrets.SLACK_BOT_TOKEN }} | |
channel-id: "#apm-agent-java" | |
message: | | |
:ghost: [${{ github.repository }}] Snapshot *${{ github.ref_name }}* didn't get triggered in Buildkite. | |
Build: (<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>) |