From e567436e0beeca361c91579079edff8c7b11bc84 Mon Sep 17 00:00:00 2001 From: mriswithe <1725647+mriswithe@users.noreply.github.com> Date: Sun, 19 Feb 2023 14:55:06 -0600 Subject: [PATCH 1/4] generic build and Dockerfile --- .docker/{resume.dockerfile => Dockerfile} | 4 +- .github/workflows/docker-update.yml | 55 ----------------------- .github/workflows/main.yaml | 35 +++++++++++++++ .github/workflows/main.yml | 36 --------------- actions/action.yml | 7 --- actions/entrypoint.sh | 3 -- 6 files changed, 38 insertions(+), 102 deletions(-) rename .docker/{resume.dockerfile => Dockerfile} (57%) delete mode 100644 .github/workflows/docker-update.yml create mode 100644 .github/workflows/main.yaml delete mode 100644 .github/workflows/main.yml delete mode 100644 actions/action.yml delete mode 100755 actions/entrypoint.sh diff --git a/.docker/resume.dockerfile b/.docker/Dockerfile similarity index 57% rename from .docker/resume.dockerfile rename to .docker/Dockerfile index 3ca15d74..61900390 100644 --- a/.docker/resume.dockerfile +++ b/.docker/Dockerfile @@ -4,4 +4,6 @@ RUN apk add make texlive ENV TEXMF /usr/share/texmf-dist -COPY actions/entrypoint.sh /entrypoint.sh +WORKDIR /home/app/resume + +ENTRYPOINT ["make", "pdf", "html"] \ No newline at end of file diff --git a/.github/workflows/docker-update.yml b/.github/workflows/docker-update.yml deleted file mode 100644 index da2b72b3..00000000 --- a/.github/workflows/docker-update.yml +++ /dev/null @@ -1,55 +0,0 @@ -# This workflow updates the docker container which has context and -# pandoc installed, and on which the resume documents are built. The -# workflow runs whenever the dockerfile is changed, and updates the -# container image in the Github Packages registry. - -name: Publish Docker Image - -# Controls when the action will run. -on: - # Triggers the workflow on push events but only for the master branch - push: - branches: [ master ] - paths-ignore: - - 'markdown/**' - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - push_to_registry: - name: Push Docker image to GitHub Packages - runs-on: ubuntu-latest - permissions: - packages: write - contents: read - steps: - - name: Check out the repo - uses: actions/checkout@v2 - - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Build and Push to GitHub Packages - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - file: .docker/resume.dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 00000000..08366c3a --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,35 @@ +name: Build inside docker image +on: + label: + types: + - created + workflow_dispatch: +env: + IMAGE_NAME: resume-image:${{github.sha}} +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --tag ${{env.IMAGE_NAME}} + working-directory: docker + - name: Build the Resume + run: docker run --rm -v ${PWD}:/home/app/resume ${{env.IMAGE_NAME}} + - name: See if it worked? + run: ls -alh output + - name: Upload PDF + uses: actions/upload-artifact@v3 + with: + # Artifact name + name: Resume PDF # optional, default is artifact + # A file, directory or wildcard pattern that describes what to upload + path: output/*.pdf + - name: Upload HTML + uses: actions/upload-artifact@v3 + with: + # Artifact name + name: Resume HTML # optional, default is artifact + # A file, directory or wildcard pattern that describes what to upload + path: output/*.html \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 27512901..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,36 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: build-resume - -# Controls when the action will run. -on: - # Triggers the workflow on push or pull request events but only for the master branch - push: - branches: [ master ] - paths: - - 'markdown/**' - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - build-resume: - runs-on: ubuntu-latest - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - - name: Test directory contents - run: 'ls -al' - - - name: Build resume - uses: ./actions - - - name: Upload a Build Artifact - uses: actions/upload-artifact@v2.2.3 - with: - # Artifact name - name: Resume PDF # optional, default is artifact - # A file, directory or wildcard pattern that describes what to upload - path: output/*.pdf - diff --git a/actions/action.yml b/actions/action.yml deleted file mode 100644 index 5da9ab10..00000000 --- a/actions/action.yml +++ /dev/null @@ -1,7 +0,0 @@ -# action.yml -name: 'Texlive Build' -description: 'Build a document using texlive' -runs: - using: 'docker' - image: 'docker://ghcr.io/mszep/pandoc_resume:master' - entrypoint: '/entrypoint.sh' diff --git a/actions/entrypoint.sh b/actions/entrypoint.sh deleted file mode 100755 index 087485a9..00000000 --- a/actions/entrypoint.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -sh -c "cd /home/app/resume && make pdf" From 004fe284fcf88ca96f5d07fe7a23390ce1f9a871 Mon Sep 17 00:00:00 2001 From: mriswithe <1725647+mriswithe@users.noreply.github.com> Date: Sun, 19 Feb 2023 14:56:46 -0600 Subject: [PATCH 2/4] fix directory --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 08366c3a..258a02c4 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v3 - name: Build the Docker image run: docker build . --tag ${{env.IMAGE_NAME}} - working-directory: docker + working-directory: .docker - name: Build the Resume run: docker run --rm -v ${PWD}:/home/app/resume ${{env.IMAGE_NAME}} - name: See if it worked? From 0cc9ed743a60e26e825d7005d61104c97037a6d1 Mon Sep 17 00:00:00 2001 From: mriswithe <1725647+mriswithe@users.noreply.github.com> Date: Sun, 19 Feb 2023 14:57:23 -0600 Subject: [PATCH 3/4] have confidence --- .github/workflows/main.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 258a02c4..f4a98bbd 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -17,8 +17,6 @@ jobs: working-directory: .docker - name: Build the Resume run: docker run --rm -v ${PWD}:/home/app/resume ${{env.IMAGE_NAME}} - - name: See if it worked? - run: ls -alh output - name: Upload PDF uses: actions/upload-artifact@v3 with: From 01373e4170b17a438ffd177c2461e09039706767 Mon Sep 17 00:00:00 2001 From: mriswithe <1725647+mriswithe@users.noreply.github.com> Date: Sun, 19 Feb 2023 15:21:51 -0600 Subject: [PATCH 4/4] refine triggers --- .github/workflows/main.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index f4a98bbd..cbea13bc 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,9 +1,11 @@ name: Build inside docker image on: - label: - types: - - created + create: workflow_dispatch: + push: + branches: [ master ] + paths: + - 'markdown/**' env: IMAGE_NAME: resume-image:${{github.sha}} jobs: @@ -14,7 +16,7 @@ jobs: uses: actions/checkout@v3 - name: Build the Docker image run: docker build . --tag ${{env.IMAGE_NAME}} - working-directory: .docker + working-directory: docker - name: Build the Resume run: docker run --rm -v ${PWD}:/home/app/resume ${{env.IMAGE_NAME}} - name: Upload PDF