1
0
mirror of synced 2025-12-19 09:57:42 -05:00

Fix artifacts v4 versioning (#49028)

This commit is contained in:
Joe Clark
2024-02-06 09:21:27 -08:00
committed by GitHub
parent 3bd6839a6e
commit a4c2a48808
4 changed files with 16 additions and 10 deletions

View File

@@ -180,15 +180,15 @@ Jobs that are dependent on a previous job's artifacts must wait for the dependen
Job 1 performs these steps:
- Performs a math calculation and saves the result to a text file called `math-homework.txt`.
- Uses the `upload-artifact` action to upload the `math-homework.txt` file with the artifact name `homework_pre`.
- Uses the `upload-artifact` action to upload the `math-homework.txt` file with the artifact name {% ifversion artifacts-v3-deprecation %}`homework_pre`{% else %}`homework`{% endif %}.
Job 2 uses the result in the previous job:
- Downloads the `homework_pre` artifact uploaded in the previous job. By default, the `download-artifact` action downloads artifacts to the workspace directory that the step is executing in. You can use the `path` input parameter to specify a different download directory.
- Downloads the {% ifversion artifacts-v3-deprecation %}`homework_pre`{% else %}`homework`{% endif %} artifact uploaded in the previous job. By default, the `download-artifact` action downloads artifacts to the workspace directory that the step is executing in. You can use the `path` input parameter to specify a different download directory.
- Reads the value in the `math-homework.txt` file, performs a math calculation, and saves the result to `math-homework.txt` again, overwriting its contents.
- Uploads the `math-homework.txt` file. As artifacts are considered immutable in `v4`, the artifact is passed a different input, `homework_final`, as a name.
- Uploads the `math-homework.txt` file. {% ifversion artifacts-v3-deprecation %}As artifacts are considered immutable in `v4`, the artifact is passed a different input, `homework_final`, as a name.{% else %}This upload overwrites the previously uploaded artifact because they share the same name.{% endif %}
Job 3 displays the result uploaded in the previous job:
- Downloads the `homework_final` artifact from Job 2.
- Downloads the {% ifversion artifacts-v3-deprecation %}`homework_final` artifact from Job 2.{% else %}`homework` artifact.{% endif %}
- Prints the result of the math equation to the log.
The full math operation performed in this workflow example is `(3 + 7) x 9 = 90`.
@@ -209,7 +209,7 @@ jobs:
- name: Upload math result for job 1
uses: {% data reusables.actions.action-upload-artifact %}
with:
name: homework_pre
name: {% ifversion artifacts-v3-deprecation %}homework_pre{% else %}homework{% endif %}
path: math-homework.txt
job_2:
@@ -220,7 +220,7 @@ jobs:
- name: Download math result for job 1
uses: {% data reusables.actions.action-download-artifact %}
with:
name: homework_pre
name: {% ifversion artifacts-v3-deprecation %}homework_pre{% else %}homework{% endif %}
- shell: bash
run: |
value=`cat math-homework.txt`
@@ -228,7 +228,7 @@ jobs:
- name: Upload math result for job 2
uses: {% data reusables.actions.action-upload-artifact %}
with:
name: homework_final
name: {% ifversion artifacts-v3-deprecation %}homework_final{% else %}homework{% endif %}
path: math-homework.txt
job_3:
@@ -239,7 +239,7 @@ jobs:
- name: Download math result for job 2
uses: {% data reusables.actions.action-download-artifact %}
with:
name: homework_final
name: {% ifversion artifacts-v3-deprecation %}homework_final{% else %}homework{% endif %}
- name: Print the final result
shell: bash
run: |

View File

@@ -0,0 +1,6 @@
# Issue 13549
# Versioning for the Artifacts v1-3 deprecation. Feb 5, 2024: Eventually this will ship to some version of GHES, at that point, we can add the GHES versioning into this fbv file.
versions:
fpt: '*'
ghec: '*'
# ghes: 'tbd'

View File

@@ -1 +1 @@
actions/download-artifact@v4
actions/download-artifact@{% ifversion artifacts-v3-deprecation %}v4{% else %}v3{% endif %}

View File

@@ -1 +1 @@
actions/upload-artifact@v4
actions/upload-artifact@{% ifversion artifacts-v3-deprecation %}v4{% else %}v3{% endif %}