grafana/.github/workflows/publish-artifact.yml

74 lines
2.3 KiB
YAML

name: Publish artifacts to bucket
on:
workflow_call:
inputs:
pattern:
description: |
(From actinos/download-artifact) Glob pattern of artifacts (instead of `name`)
Be careful when using this option; the contents of the root of each artifact are coalesced, so ensure that they do not collide.
type: string
required: false
name:
description: (From actinos/download-artifact) Name of the GitHub artifact to upload (Ignored if `pattern` is set)
type: string
required: false
bucket:
description: Name of the GCS bucket
type: string
required: true
bucket-path:
description: Path in the GCS bucket
type: string
required: false
default: "."
environment:
description: "'prod' or 'dev'"
type: string
required: false
default: dev
run-id:
type: string
required: true
service-account:
type: string
required: false
default: github-prerelease-writer@grafanalabs-workload-identity.iam.gserviceaccount.com
runs-on:
type: string
required: false
default: github-hosted-ubuntu-x64-small
jobs:
publish:
runs-on: ${{ inputs.runs-on }}
name: Publish
permissions:
id-token: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
name: ${{ inputs.name }}
pattern: ${{ inputs.pattern }}
run-id: ${{ inputs.run-id }}
path: ./artifact
- name: Log in to GCS
id: login-to-gcs
uses: grafana/shared-workflows/actions/login-to-gcs@main
with:
environment: ${{ inputs.environment }}
service_account: ${{ inputs.service-account }}
- name: Coalesce artifacts
run: |
mkdir out
find ./artifact -mindepth 2 -maxdepth 2 -exec cp -r {} out/ \;
ls -al out
- name: Upload artifacts
uses: grafana/shared-workflows/actions/push-to-gcs@main
with:
bucket: ${{ inputs.bucket }}
environment: ${{ inputs.environment }}
parent: false
path: out
bucket_path: ${{ inputs.bucket-path }}
service_account: ${{ inputs.service-account }}
gzip: false