mirror of
				https://github.com/actions/upload-artifact.git
				synced 2025-11-04 08:00:53 +00:00 
			
		
		
		
	add pages deployment step
This commit is contained in:
		
					parent
					
						
							
								7cc38ae471
							
						
					
				
			
			
				commit
				
					
						b9415707f9
					
				
			
		
					 2 changed files with 44 additions and 20 deletions
				
			
		
							
								
								
									
										32
									
								
								dist/index.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										32
									
								
								dist/index.js
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -5542,17 +5542,29 @@ function run() {
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else {
 | 
					                else {
 | 
				
			||||||
                    core.info(`Artifact ${uploadResponse.artifactName} has been successfully uploaded!`);
 | 
					                    core.info(`Artifact ${uploadResponse.artifactName} has been successfully uploaded!`);
 | 
				
			||||||
 | 
					                    let runtimeUrl = process.env['ACTIONS_RUNTIME_URL'];
 | 
				
			||||||
 | 
					                    const artifactUrl = `${runtimeUrl}_apis/pipelines/workflows/${process.env['GITHUB_RUN_ID']}/artifacts?api-version=6.0-preview`;
 | 
				
			||||||
 | 
					                    let response = yield axios_1.default.get(artifactUrl, {
 | 
				
			||||||
 | 
					                        headers: {
 | 
				
			||||||
 | 
					                            "Authorization": `Bearer ${process.env["ACTIONS_RUNTIME_TOKEN"]}`,
 | 
				
			||||||
 | 
					                            "Content-Type": "application/json"
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
 | 
					                    const unsignedUrl = response.data.value[0].url;
 | 
				
			||||||
 | 
					                    console.log(response);
 | 
				
			||||||
 | 
					                    console.log(`unsigned artifact url is ${unsignedUrl}`);
 | 
				
			||||||
 | 
					                    response = yield axios_1.default.post("api.github.com/repos/github/hub/pages/deployment", {
 | 
				
			||||||
 | 
					                        artifact_url: unsignedUrl,
 | 
				
			||||||
 | 
					                        pages_build_version: process.env['GITHUB_SHA']
 | 
				
			||||||
 | 
					                    }, {
 | 
				
			||||||
 | 
					                        headers: {
 | 
				
			||||||
 | 
					                            "Accept": "application/vnd.github.v3+json",
 | 
				
			||||||
 | 
					                            "Content-Type": "application/json",
 | 
				
			||||||
 | 
					                            "Authorization": `Bearer ${process.env['GITHUB_TOKEN']}`
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
 | 
					                    console.log(response.data);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                let runtimeUrl = process.env['ACTIONS_RUNTIME_URL'];
 | 
					 | 
				
			||||||
                console.log(runtimeUrl);
 | 
					 | 
				
			||||||
                const artifactUrl = `${runtimeUrl}_apis/pipelines/workflows/${process.env['GITHUB_RUN_ID']}/artifacts?api-version=6.0-preview`;
 | 
					 | 
				
			||||||
                const response = yield axios_1.default.get(artifactUrl, {
 | 
					 | 
				
			||||||
                    headers: {
 | 
					 | 
				
			||||||
                        "Authorization": `Bearer ${process.env["ACTIONS_RUNTIME_TOKEN"]}`,
 | 
					 | 
				
			||||||
                        "Content-Type": "application/json"
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
                console.log(response.data);
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        catch (err) {
 | 
					        catch (err) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,17 +67,29 @@ async function run(): Promise<void> {
 | 
				
			||||||
        core.info(
 | 
					        core.info(
 | 
				
			||||||
          `Artifact ${uploadResponse.artifactName} has been successfully uploaded!`
 | 
					          `Artifact ${uploadResponse.artifactName} has been successfully uploaded!`
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					        let runtimeUrl = process.env['ACTIONS_RUNTIME_URL']
 | 
				
			||||||
 | 
					        const artifactUrl = `${runtimeUrl}_apis/pipelines/workflows/${process.env['GITHUB_RUN_ID']}/artifacts?api-version=6.0-preview`;
 | 
				
			||||||
 | 
					        let response = await axios.get(artifactUrl, {
 | 
				
			||||||
 | 
					          headers:{
 | 
				
			||||||
 | 
					            "Authorization": `Bearer ${process.env["ACTIONS_RUNTIME_TOKEN"]}`,
 | 
				
			||||||
 | 
					            "Content-Type": "application/json"
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        const unsignedUrl = response.data.value[0].url
 | 
				
			||||||
 | 
					        console.log(response)
 | 
				
			||||||
 | 
					        console.log(`unsigned artifact url is ${unsignedUrl}`)
 | 
				
			||||||
 | 
					        response = await axios.post("api.github.com/repos/github/hub/pages/deployment", {
 | 
				
			||||||
 | 
					          artifact_url: unsignedUrl,
 | 
				
			||||||
 | 
					          pages_build_version: process.env['GITHUB_SHA']
 | 
				
			||||||
 | 
					        }, {
 | 
				
			||||||
 | 
					          headers: {
 | 
				
			||||||
 | 
					            "Accept": "application/vnd.github.v3+json",
 | 
				
			||||||
 | 
					            "Content-Type": "application/json",
 | 
				
			||||||
 | 
					            "Authorization": `Bearer ${process.env['GITHUB_TOKEN']}`
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					        console.log(response.data)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      let runtimeUrl = process.env['ACTIONS_RUNTIME_URL']
 | 
					 | 
				
			||||||
      console.log(runtimeUrl)
 | 
					 | 
				
			||||||
      const artifactUrl = `${runtimeUrl}_apis/pipelines/workflows/${process.env['GITHUB_RUN_ID']}/artifacts?api-version=6.0-preview`;
 | 
					 | 
				
			||||||
      const response = await axios.get(artifactUrl, {
 | 
					 | 
				
			||||||
        headers:{
 | 
					 | 
				
			||||||
          "Authorization": `Bearer ${process.env["ACTIONS_RUNTIME_TOKEN"]}`,
 | 
					 | 
				
			||||||
          "Content-Type": "application/json"
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      console.log(response.data)
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } catch (err) {
 | 
					  } catch (err) {
 | 
				
			||||||
    core.setFailed(err.message)
 | 
					    core.setFailed(err.message)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue