'Dynamic naming for build artifacts zip file
in my repo, I have yml file with the code below /.github/workflows/filename.yml
- name: Create Artifact
uses: actions/upload-artifiact@v2
with:
name: Report.22.9.zip
path: |
project
!project/Reports/*
!project/Logs/*
!project/Snapshots/*
Now, I'm trying to make "name: Report.22.9.zip" more dynamic. Something like this
<repo_name>.<branch_name>.<git_build_id>.zip
Solution 1:[1]
You can create artifact name in previous step and provide it as output to be used by artifact upload step.
name: Dynamic artifact name
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Generate artifact name
id: generate-name
run: |
echo "::set-output name=artifact::${{ github.event.repository.name }}.${{ github.ref_name }}.${{ github.run_id }}.zip"
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ steps.generate-name.outputs.artifact }}
path: ./README.md
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | frennky |
