Build Resume and Push Docker image #210
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Resume and Push Docker image | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
pull_request: | |
branches: | |
- main | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
IMAGE_NAME: resume | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- | |
uses: actions/checkout@v3 | |
- | |
name: Pull latest resume json and build page. | |
run: | | |
cd src | |
wget https://gist.github.com/tomp736/dbe65122dd7bca0a0d08a1758997ef50/raw/ -O resume.json | |
python build_resume.py > index.html | |
- | |
name: Copy file(s). | |
run: | | |
cp -r src/static container/public-html/static | |
cp src/index.html container/public-html/index.html | |
cp src/templates/default.css container/public-html/default.css | |
- | |
name: Archive resume file(s). | |
uses: actions/upload-artifact@v3 | |
with: | |
name: files | |
path: container/public-html/* | |
- | |
if: github.ref == 'refs/heads/main' | |
name: GH Pages Deploy | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: container/public-html/ | |
- | |
if: github.ref == 'refs/heads/main' | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
if: github.ref == 'refs/heads/main' | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
if: github.ref == 'refs/heads/main' | |
name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
if: github.ref == 'refs/heads/main' | |
name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./container | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }} | |
ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME }}:latest |