Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: add build workflow + run docker workflow only if secrets are set #295

Merged
merged 5 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading