actions / upload-pages-artifact

A composite action for packaging and uploading an artifact that can be deployed to GitHub Pages.
https://pages.github.com
MIT License
283 stars 71 forks source link

Upload pages artifact with upload-artifact v4-beta #78

Closed konradpabjan closed 10 months ago

konradpabjan commented 10 months ago

Overview

Closes https://github.com/github/actions-results-team/issues/1987

We have a v4-beta branch of upload-artifact that we are starting to use internally. Note that it only works for select repositories that have the necessary feature flags enabled.

One of the main differences between v1-v3 upload-artifact and v4 is that the artifact will become available immediately in the UI and the artifact ID will also immediately be available as a step output. See https://github.com/actions/upload-artifact/blob/aa5cae10db2b39d79f5244f6bc5084278993a3ae/action.yml#L26-L31

We need to output the artifact ID so that we can use it later in the pages deployment flow.

Testing

See https://github.com/bbq-beets/testing-artifacts-v4/actions/runs/6658237875 for an E2E flow.

With a workflow file such as this we are able to successfully output and display the artifact ID in another job. Long term this ID will be used as input to create a deployment.

jobs:
  build:
    runs-on: ubuntu-latest
    outputs:
      artifact-id: ${{ steps.upload-pages-artifact.outputs.artifact-id }}
    steps:
      - uses: actions/checkout@v3
      - name: Build
        uses: actions/jekyll-build-pages@v1
      - name: Upload Pages artifact
        id: upload-pages-artifact
        uses: konradpabjan/upload-pages-artifact@main

  job2:
    runs-on: ubuntu-latest
    needs: build
    steps:          
      - name: Display Artifact ID
        env:
            OUTPUT1: ${{needs.build.outputs.artifact-id}}
        run: |
          echo "Artifact ID from previous job is $OUTPUT1"

image

JamesMGreene commented 10 months ago

The failing test is an acceptable flake in a new service that has been noted and will be addressed. 👍🏻