CI: Add publish-artifact workflow (#107138)
* dispatch GE release build when this one is triggered * Add publish-artifact workflow * workflow_call is its own job * add needs section in publish * fix workflow reference * fix permissions * Use pattern arg instead of name * fix artifacts path * log in to docker hub in build job * remove duplicate key * bucket_path -> bucket-path * remove 'parent' input * PATH -> ARTIFACT_PATH * use find instead of rsync * set min/maxdepth * use cp -r * Add publish-artifact.yml to CODEOWNERS * refer to the workflow on main specifically
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
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
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: github-hosted-ubuntu-x64-small
|
||||
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@login-to-gcs/v0.2.1
|
||||
with:
|
||||
environment: ${{ inputs.environment }}
|
||||
- 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@push-to-gcs-v0.2.0
|
||||
with:
|
||||
bucket: ${{ inputs.bucket }}
|
||||
environment: ${{ inputs.environment }}
|
||||
parent: false
|
||||
path: out
|
||||
bucket_path: ${{ inputs.bucket-path }}
|
||||
Reference in New Issue
Block a user