Skip to content

Commit

Permalink
Fix pipeline by storing artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
Tugark committed Feb 13, 2024
1 parent 9bd77b4 commit eb0f275
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
on:
workflow_call:
inputs:
store-artifact:
description: 'Whether the built artifact should be stored'
default: false
required: false
type: boolean
artifact-name:
description: 'Name of the artifact, defaults to `built-app`'
default: built-app
required: false
type: string

jobs:
build:
Expand All @@ -14,4 +25,11 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Build app
run: npm run build
run: npm run build
- name: Archive build artifacts
if: ${{ inputs.store-artifact }}
uses: actions/upload-artifact@v2
with:
name: ${{ inputs.artifact-name }}
path: ./build
retention-days: 3 # we only store these for 3 days because they're almost always immediately used
16 changes: 15 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,19 @@ on:
push:
branches:
- main
- feature/fix-pipeline-empty # todo: only for testing

env:
ARTIFACT_NAME: built-app
BUILD_DIRECTORY: ./build

jobs:
build:
name: Check Build
uses: ./.github/workflows/build.yml
with:
store-artifact: true
artifact-name: $ARTIFACT_NAME

deploy:
permissions:
Expand All @@ -17,8 +26,13 @@ jobs:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: $ARTIFACT_NAME
path: $BUILD_DIRECTORY
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
publish_dir: $BUILD_DIRECTORY

0 comments on commit eb0f275

Please sign in to comment.