2024-10-27 11:33:49 +00:00
|
|
|
|
jobs:
|
2024-10-28 03:00:32 +00:00
|
|
|
|
# 第一个 Job:检出代码并上传
|
|
|
|
|
checkout_and_upload:
|
|
|
|
|
runs-on: ubuntu-latest
|
2024-10-27 11:33:49 +00:00
|
|
|
|
steps:
|
2024-10-28 03:00:32 +00:00
|
|
|
|
- name: 🛒 检出代码
|
2024-10-27 11:33:49 +00:00
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
2024-10-28 03:00:32 +00:00
|
|
|
|
- name: 📦 上传代码作为工件
|
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
|
with:
|
|
|
|
|
name: source-code # 工件名称
|
|
|
|
|
path: . # 上传当前目录的所有内容
|
2024-10-27 11:33:49 +00:00
|
|
|
|
|
2024-10-28 03:00:32 +00:00
|
|
|
|
# 第二个 Job:下载工件并使用代码
|
|
|
|
|
download_and_use:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
needs: checkout_and_upload # 确保在第一个 Job 完成后再运行
|
|
|
|
|
steps:
|
|
|
|
|
- name: 📥 下载代码工件
|
|
|
|
|
uses: actions/download-artifact@v3
|
2024-10-27 11:33:49 +00:00
|
|
|
|
with:
|
2024-10-28 03:00:32 +00:00
|
|
|
|
name: source-code # 下载第一个 Job 中的工件
|
2024-10-27 11:33:49 +00:00
|
|
|
|
|
2024-10-28 03:00:32 +00:00
|
|
|
|
- name: 🔍 使用下载的代码
|
|
|
|
|
run: |
|
|
|
|
|
ls -la # 确认文件是否已成功下载
|
|
|
|
|
# 这里可以继续使用检出的代码进行构建或其他操作
|