diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index ace7212..3feb8d5 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -13,6 +13,10 @@ inputs: required: false description: "Docker stage to target" default: "final" + push: + required: false + description: "Should image be pushed to registries" + default: "false" outputs: image: @@ -31,6 +35,14 @@ outputs: runs: using: "composite" steps: + - name: Login to Container Registry + if: inputs.push == 'true' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ inputs.username }} + password: ${{ inputs.password }} + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -91,10 +103,12 @@ runs: labels: ${{ steps.meta.outputs.labels }} annotations: ${{ steps.meta.outputs.annotations }} # Output image to a local tar file to be uploaded - outputs: type=docker,dest=${{ steps.tar.outputs.path }} + # Also push to registry when appropriate + outputs: | + type=docker,dest=${{ steps.tar.outputs.path }} + type=image,name=${{ steps.tag.outputs.tag }},push=${{ inputs.push }} # Target a specified stage target: ${{ inputs.target }} - push: true - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index a8f7d3e..e69021a 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -31,13 +31,9 @@ jobs: with: node_env: production latest: ${{ steps.context.outputs.is_release_master }} - - - uses: ./.github/actions/push - if: steps.context.outputs.is_fork == 'false' - with: + push: ${{ steps.context.outputs.is_fork == 'false' }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ steps.build.outputs.tag }} download: runs-on: ubuntu-latest