Work around date±duration operations being broken #10
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 | |
on: | |
push: | |
branches: | |
- '**' | |
tags: | |
- 'v*.*.*' | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
node-version: '18' | |
cache: yarn | |
- run: yarn install | |
- run: yarn workspace @ping-board/common lint | |
- run: yarn workspace @ping-board/backend lint | |
- run: yarn workspace @ping-board/frontend lint | |
build-backend-docker: | |
runs-on: ubuntu-latest | |
needs: lint | |
if: startsWith(github.ref, 'refs/tags/') # Only run for Tags | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Docker Metadata action | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ghcr.io/${{ github.repository }}-backend | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and Push | |
uses: docker/[email protected] | |
with: | |
context: . | |
file: ./packages/backend/Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.output.labels }} | |
build-backend: | |
runs-on: ubuntu-latest | |
needs: lint | |
# Only run for Tags and when making a PR to the main branch | |
if: startsWith(github.ref, 'refs/tags/') || github.base_ref == 'main' | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: '18' | |
cache: yarn | |
- name: Install Dependencies | |
run: yarn workspaces focus @ping-board/backend | |
- name: Build | |
run: yarn workspace @ping-board/backend build | |
- name: Remove Dev-Dependencies | |
run: | | |
rm -rf ./.yarn/cache | |
rm -rf ./.pnp.cjs | |
yarn workspaces focus --production @ping-board/backend | |
- name: Upload Release Artifact | |
if: startsWith(github.ref, 'refs/tags/') # Only run for Tags | |
uses: actions/[email protected] | |
with: | |
name: backend | |
path: | | |
.pnp.cjs | |
.yarn | |
.yarnrc.yml | |
yarn.lock | |
package.json | |
packages/backend/package.json | |
packages/backend/build | |
packages/common/package.json | |
packages/common/build | |
packages/common/package.json | |
LICENSE | |
build-frontend-docker: | |
runs-on: ubuntu-latest | |
needs: lint | |
if: startsWith(github.ref, 'refs/tags/') # Only run for Tags | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Docker Metadata action | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ghcr.io/${{ github.repository }}-frontend | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and Push | |
uses: docker/[email protected] | |
with: | |
context: . | |
file: ./packages/frontend/Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.output.labels }} | |
build-frontend: | |
runs-on: ubuntu-latest | |
needs: lint | |
# Only run for Tags and when making a PR to the main branch | |
if: startsWith(github.ref, 'refs/tags/') || github.base_ref == 'main' | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: '18' | |
cache: yarn | |
- name: Install Dependencies | |
run: yarn workspaces focus ping-board @ping-board/frontend | |
- name: Build | |
run: yarn workspace @ping-board/frontend build | |
- name: Upload Release Artifact | |
if: startsWith(github.ref, 'refs/tags/') # Only run for Tags | |
uses: actions/[email protected] | |
with: | |
name: frontend | |
path: packages/frontend/build | |
release: | |
runs-on: ubuntu-latest | |
needs: | |
- build-backend | |
- build-frontend | |
if: startsWith(github.ref, 'refs/tags/') # Only run for Tags | |
steps: | |
- name: Download Backend Build Artifact | |
uses: actions/[email protected] | |
with: | |
name: backend | |
path: backend | |
- name: Zip Backend Files | |
run: zip -r ../backend.zip . | |
working-directory: backend | |
- name: Download Frontend Build Artifact | |
uses: actions/[email protected] | |
with: | |
name: frontend | |
path: frontend | |
- name: Zip Frontend Files | |
run: zip -r ../frontend.zip . | |
working-directory: frontend | |
- name: Create Release | |
uses: softprops/[email protected] | |
with: | |
files: | | |
backend.zip | |
frontend.zip |