Merge branch 'open-sauced:main' into main #9
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: "Release" | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
docker: | |
name: Build container | |
runs-on: ubuntu-latest | |
steps: | |
- name: "☁️ checkout repository" | |
uses: actions/checkout@v2 | |
- name: "🔧 setup buildx" | |
uses: docker/setup-buildx-action@v1 | |
- name: "🔧 cache docker layers" | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: "🔧 docker meta" | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ github.repository }} | |
tags: latest | |
- name: "📦 docker build" | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
outputs: type=docker,dest=/tmp/docker.tar | |
push: false | |
cache-from: type=gha, scope=${{ github.workflow }} | |
cache-to: type=gha, scope=${{ github.workflow }} | |
- name: "📂 docker artifacts" | |
uses: actions/upload-artifact@v2 | |
with: | |
name: docker | |
path: /tmp/docker.tar | |
build: | |
name: Build application | |
runs-on: ubuntu-latest | |
steps: | |
- name: "☁️ checkout repository" | |
uses: actions/checkout@v2 | |
- name: "🔧 setup node" | |
uses: actions/[email protected] | |
with: | |
node-version: 18 | |
- name: "🔧 install npm@latest" | |
run: npm i -g npm@latest | |
- name: "📦 install dependencies" | |
uses: bahmutov/npm-install@v1 | |
- name: "🚀 static app" | |
run: npm run build | |
- name: "📂 production artifacts" | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build | |
path: build | |
release: | |
environment: | |
name: production | |
url: https://github.com/${{ github.repository }}/releases/tag/${{ env.RELEASE_TAG }} | |
name: Semantic release | |
needs: | |
- docker | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- name: "☁️ checkout repository" | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: "📂 download docker artifacts" | |
uses: actions/download-artifact@v2 | |
with: | |
name: docker | |
path: /tmp | |
- name: "📦 load tag" | |
run: | | |
docker load --input /tmp/docker.tar | |
docker image ls -a | |
- name: "📂 download build artifacts" | |
uses: actions/download-artifact@v2 | |
with: | |
name: build | |
path: /tmp/build | |
- name: "🚀 release" | |
id: semantic-release | |
uses: docker://ghcr.io/open-sauced/semantic-release-conventional-config:3.0.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
name: Deploy to static | |
needs: | |
- build | |
- release | |
runs-on: ubuntu-latest | |
services: | |
docs: | |
image: ghcr.io/${{ github.repository }}:latest | |
ports: | |
- 8080:80 | |
steps: | |
- name: "☁️ checkout repository" | |
uses: actions/checkout@v2 | |
- name: "📂 download artifacts" | |
uses: actions/download-artifact@v2 | |
with: | |
name: build | |
path: /home/runner/build | |
- name: Install Prince | |
run: | | |
curl https://www.princexml.com/download/prince-14.2-linux-generic-x86_64.tar.gz -O | |
tar zxf prince-14.2-linux-generic-x86_64.tar.gz | |
cd prince-14.2-linux-generic-x86_64 | |
yes "" | sudo ./install.sh | |
- name: "🔧 setup node" | |
uses: actions/[email protected] | |
with: | |
node-version: 18 | |
- name: "🔧 install npm@latest" | |
run: npm i -g npm@latest | |
- name: "📦 install dependencies" | |
uses: bahmutov/npm-install@v1 | |
- name: "📂 copy artifacts" | |
run: cp -R /home/runner/build . | |
- name: "🚀 generate pdf" | |
run: npm run pdf | |
- name: "🚀 deploy static" | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./build | |
commit_message: ${{ github.event.head_commit.message }} | |
enable_jekyll: false | |
cname: docs.opensauced.pizza | |
cleanup: | |
name: Cleanup actions | |
needs: | |
- deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: "♻️ remove build artifacts" | |
uses: geekyeggo/delete-artifact@v1 | |
with: | |
name: | | |
build | |
docker |