Skip to content

Job間のartifactは引き継がれない #15

@waviaei

Description

@waviaei

現象

Job の build と deploy がある場合、build でビルドしたアウトプットは deploy には引き継がれない。needs: ['build'] してもダメ。

actions/checkout#19 (comment)

Each job runs in a fresh version of the virtual environment, so you'd need to checkout for each job. You can have multiple steps for each job, and the environment will remain across steps, but you aren't able to persist the environment entirely across separate jobs.

If you need to persist data across different jobs you may want have a look at using the artifact upload and download actions. This will allow you to pass files/folders between different jobs:

https://github.com/actions/upload-artifact
https://github.com/actions/download-artifact

なので、workflow は完走するが、ビルドされたファイルがデプロイされずに、checkout し直されたビルド前のファイル群がデプロイされた。
確認されたのはこの yml で、
https://github.com/tarosky/ls-kitaharahosp-theme/blob/chore/issue%2392/.github/workflows/deploy-to-production.yml
走ったこのactionです
https://github.com/tarosky/ls-kitaharahosp-theme/actions/runs/5764676781

解決案

案1
上記にもあるように upload-artifact と download-artifact を使う。しかしこれでは tarosky/workflows/.github/workflows/npm.yml@main に upload-artifact を付け足す必要があり、その artifact をどうにか別の workflow に渡すということが必要。

案2
「ビルド」部分を workflow ではなく、composite action にしておいた方が step として組み込めるので、複数の job がある step の中にも、単体で1つの job でも、状況によって組み込みやすい?
ただし、with に相当するものを渡せるようにしないと使い勝手は悪くなる。

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions