This repository has been archived by the owner on Oct 10, 2024. It is now read-only.
feat: use browser feature to print preview a pdf (#61) #26
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
# https://nuxt.com/deploy/github-pages | |
# https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions | |
name: Deploy to GitHub Pages | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
env: | |
NODE_VERSION: 20.11 | |
PNPM_VERSION: 8 | |
IMAGE_NAME: nice-resume | |
jobs: | |
build: | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: ${{ env.PNPM_VERSION }} | |
- name: Dump version | |
run: | | |
echo "Node version: $(node -v) (aiming: ${{ env.NODE_VERSION }})" | |
echo "Npm version: $(npm --version)" | |
echo "Pnpm version: $(pnpm --version) (aiming: ${{ env.PNPM_VERSION }})" | |
echo "Git version: $(git --version)" | |
- name: Set env with commit hash | |
run: echo "SHORT_SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: "Configure baseUrl to work on Github Pages" | |
run: | | |
sed -i "s|baseURL: \"/\"|baseURL: \"/nice-resume/\"|g" nuxt.config.ts | |
- name: "Configure package.json version" | |
run: | | |
sed -i "s|\"version\": \"dev\"|\"version\": \"${{ env.SHORT_SHA }}\"|g" package.json | |
- name: Build | |
run: pnpm run build --preset github_pages | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./.output/public | |
deploy: | |
timeout-minutes: 5 | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github_pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
container_build_push: | |
needs: build | |
permissions: | |
packages: write | |
contents: read | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: echo "SHORT_SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV | |
- name: Build image | |
run: docker build --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" . | |
- name: Log in to registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
- name: Push image | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | |
# This changes all uppercase characters to lowercase. | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
docker tag $IMAGE_NAME $IMAGE_ID:${{ env.SHORT_SHA }} | |
docker tag $IMAGE_NAME $IMAGE_ID:latest | |
docker push $IMAGE_ID:${{ env.SHORT_SHA }} | |
docker push $IMAGE_ID:latest |