Skip to content

Commit

Permalink
Merge pull request #295 from prusnak/ci-build
Browse files Browse the repository at this point in the history
CI: add build workflow + run docker workflow only if secrets are set
  • Loading branch information
callebtc authored Dec 26, 2024
2 parents 7fb2d36 + 282ce11 commit 75cbfa0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Check build

on: [push, pull_request]

jobs:
build-check:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"

- name: Install dependencies
run: npm install

- name: Run build check
run: |
npm run build
npm run build:pwa
16 changes: 16 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,23 @@ on:
types: [released]

jobs:
check-secrets:
runs-on: ubuntu-latest
outputs:
secrets_set: ${{ steps.check.outputs.secrets_set }}
steps:
- name: Check if secrets are set
run: |
if [ -z "${{ secrets.DOCKER_USERNAME }}" ]; then
echo "secrets_set=false" >> $GITHUB_OUTPUT
else
echo "secrets_set=true" >> $GITHUB_OUTPUT
fi
build-and-push:
# run only when secrets are set
needs: check-secrets
if: ${{ needs.check-secrets.outputs.secrets_set == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"

- name: Install dependencies
run: npm install
Expand Down

0 comments on commit 75cbfa0

Please sign in to comment.