diff options
| -rw-r--r-- | .github/workflows/build.yaml | 14 | ||||
| -rw-r--r-- | .github/workflows/deploy.yaml | 7 | ||||
| -rw-r--r-- | .github/workflows/lint.yaml | 7 | ||||
| -rw-r--r-- | .github/workflows/main.yaml | 3 | ||||
| -rw-r--r-- | .github/workflows/test.yaml | 7 | 
5 files changed, 28 insertions, 10 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bd9bb55..e0bbdbe 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,15 +3,21 @@ name: Build image  on:    workflow_call:      outputs: +      artefact: +        description: The name of the uploaded image aretfact. +        value: ${{ jobs.build.outputs.artefact }}        tag: -        description: The tag used for the built image +        description: The tag used for the built image.          value: ${{ jobs.build.outputs.tag }}  jobs:    build:      runs-on: ubuntu-latest      outputs: +      artefact: ${{ env.artefact }}        tag: ${{ steps.sha_tag.outputs.tag }} +    env: +      artefact: image_artefact_snekbox-venv      steps:        # Create a short SHA with which to tag built images. @@ -72,7 +78,7 @@ jobs:            push: false            target: venv            build-args: DEV=1 -          outputs: type=docker,dest=image_artefact_snekbox-venv.tar +          outputs: type=docker,dest=${{ env.artefact }}.tar            cache-from: |              ${{ steps.cache_config.outputs.cache_from }}              ghcr.io/python-discord/snekbox-base:latest @@ -85,7 +91,7 @@ jobs:        - name: Upload image archive as an artefact          uses: actions/upload-artifact@v2          with: -          name: image_artefact_snekbox-venv_${{ steps.sha_tag.outputs.tag }} -          path: image_artefact_snekbox-venv.tar +          name: ${{ env.artefact }} +          path: ${{ env.artefact }}.tar            retention-days: 1  # It's only needed for the duration of the workflow.            if-no-files-found: error diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index a04cf86..4183917 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -3,6 +3,9 @@ name: Deploy & push images  on:    workflow_call:      inputs: +      artefact: +        required: true +        type: string        tag:          required: true          type: string @@ -16,11 +19,11 @@ jobs:        - name: Download image artefact          uses: actions/download-artifact@v2          with: -          name: image_artefact_snekbox-venv_${{ inputs.tag }} +          name: ${{ inputs.artefact }}        # Load the image to make use of common layers during the final build.        - name: Load image from archive -        run: docker load -i image_artefact_snekbox-venv.tar +        run: docker load -i ${{ inputs.artefact }}.tar        - name: Set up Docker Buildx          uses: docker/setup-buildx-action@v1 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 585e8e4..111df54 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -3,6 +3,9 @@ name: Lint  on:    workflow_call:      inputs: +      artefact: +        required: true +        type: string        tag:          required: true          type: string @@ -16,10 +19,10 @@ jobs:        - name: Download image artefact          uses: actions/download-artifact@v2          with: -          name: image_artefact_snekbox-venv_${{ inputs.tag }} +          name: ${{ inputs.artefact }}        - name: Load image from archive -        run: docker load -i image_artefact_snekbox-venv.tar +        run: docker load -i ${{ inputs.artefact }}.tar        # Needed for the Docker Compose file.        - name: Checkout code diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ef59f78..cc8a1e0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -13,15 +13,18 @@ jobs:      uses: ./.github/workflows/lint.yaml      needs: build      with: +      artefact: ${{ needs.build.outputs.artefact }}        tag: ${{ needs.build.outputs.tag }}    test:      uses: ./.github/workflows/test.yaml      needs: build      with: +      artefact: ${{ needs.build.outputs.artefact }}        tag: ${{ needs.build.outputs.tag }}    deploy:      uses: ./.github/workflows/deploy.yaml      if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}      needs: [build, lint, test]      with: +      artefact: ${{ needs.build.outputs.artefact }}        tag: ${{ needs.build.outputs.tag }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 05145d5..8a4078a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -3,6 +3,9 @@ name: Test  on:    workflow_call:      inputs: +      artefact: +        required: true +        type: string        tag:          required: true          type: string @@ -19,10 +22,10 @@ jobs:        - name: Download image artefact          uses: actions/download-artifact@v2          with: -          name: image_artefact_snekbox-venv_${{ inputs.tag }} +          name: ${{ inputs.artefact }}        - name: Load image from archive -        run: docker load -i image_artefact_snekbox-venv.tar +        run: docker load -i ${{ inputs.artefact }}.tar        # Needed for the Docker Compose file.        - name: Checkout code  |