|
| 1 | +# This workflow updates the docker container which has context and |
| 2 | +# pandoc installed, and on which the resume documents are built. The |
| 3 | +# workflow runs whenever the dockerfile is changed, and updates the |
| 4 | +# container image in the Github Packages registry. |
| 5 | + |
| 6 | +name: Publish Docker Image |
| 7 | + |
| 8 | +# Controls when the action will run. |
| 9 | +on: |
| 10 | + # Triggers the workflow on push events but only for the master branch |
| 11 | + push: |
| 12 | + branches: [ master ] |
| 13 | + paths-ignore: |
| 14 | + - 'markdown/**' |
| 15 | + |
| 16 | + # Allows you to run this workflow manually from the Actions tab |
| 17 | + workflow_dispatch: |
| 18 | + |
| 19 | +env: |
| 20 | + REGISTRY: ghcr.io |
| 21 | + IMAGE_NAME: ${{ github.repository }} |
| 22 | + |
| 23 | +jobs: |
| 24 | + push_to_registry: |
| 25 | + name: Push Docker image to GitHub Packages |
| 26 | + runs-on: ubuntu-latest |
| 27 | + permissions: |
| 28 | + packages: write |
| 29 | + contents: read |
| 30 | + steps: |
| 31 | + - name: Check out the repo |
| 32 | + uses: actions/checkout@v2 |
| 33 | + |
| 34 | + - name: Log in to the Container registry |
| 35 | + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 |
| 36 | + with: |
| 37 | + registry: ${{ env.REGISTRY }} |
| 38 | + username: ${{ github.actor }} |
| 39 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + |
| 41 | + - name: Extract metadata (tags, labels) for Docker |
| 42 | + id: meta |
| 43 | + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 |
| 44 | + with: |
| 45 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 46 | + |
| 47 | + - name: Build and Push to GitHub Packages |
| 48 | + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc |
| 49 | + with: |
| 50 | + context: . |
| 51 | + file: .docker/resume.dockerfile |
| 52 | + push: true |
| 53 | + tags: ${{ steps.meta.outputs.tags }} |
| 54 | + labels: ${{ steps.meta.outputs.labels }} |
| 55 | + |
0 commit comments