Bump version to 0.2.4 #480
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, pull_request] | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
jobs: | ||
basic-checks: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
# See https://github.com/Automattic/node-canvas/issues/599#issuecomment-1336370909 | ||
- run: sudo apt-get install -y libsdl-pango-dev libgif-dev | ||
- uses: actions/checkout@v4 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.node-version' | ||
cache: 'npm' | ||
cache-dependency-path: 'package-lock.json' | ||
- run: npm ci | ||
- run: npm run check-packages | ||
lint: | ||
needs: basic-checks | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- run: sudo apt-get install -y libsdl-pango-dev libgif-dev | ||
- uses: actions/checkout@v4 | ||
- name: Cache build | ||
id: cache-build | ||
uses: actions/cache@v4 | ||
with: | ||
path: node_modules/.cache/nx | ||
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}-build | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.node-version' | ||
cache: 'npm' | ||
cache-dependency-path: 'package-lock.json' | ||
- run: npm ci | ||
- run: npm run lint | ||
build-app: | ||
needs: basic-checks | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
strategy: | ||
matrix: | ||
workspace: [ | ||
common, | ||
client, | ||
server, | ||
portal | ||
] | ||
steps: | ||
- run: sudo apt-get install -y libsdl-pango-dev libgif-dev | ||
- uses: actions/checkout@v4 | ||
- name: Cache build | ||
id: cache-build | ||
uses: actions/cache@v4 | ||
with: | ||
path: node_modules/.cache/nx | ||
key: ${{ runner.os }}-nx-${{ hashFiles('package-lock.json') }} | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.node-version' | ||
cache: 'npm' | ||
cache-dependency-path: 'package-lock.json' | ||
- run: npm ci | ||
- run: npx lerna run build --scope=@fumix/fu-blog-${{ matrix.workspace }} | ||
- run: echo "This file is placed at the project root, so Github preserves the artifact paths (see https://github.com/actions/upload-artifact/issues/206)" > root.txt | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist-${{ matrix.workspace }} | ||
path: | # Important to use `|` to preserve the path (see https://github.com/actions/upload-artifact/issues/55#issuecomment-633825395) | ||
Check failure on line 81 in .github/workflows/build.yml GitHub Actions / buildInvalid workflow file
|
||
${{ matrix.workspace }}/dist/** | ||
root-${{ matrix-workspace }}.txt | ||
if-no-files-found: error | ||
test: | ||
needs: build-app | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- run: sudo apt-get install -y libsdl-pango-dev libgif-dev | ||
- uses: actions/checkout@v4 | ||
- name: Cache build | ||
id: cache-build | ||
uses: actions/cache@v4 | ||
with: | ||
path: node_modules/.cache/nx | ||
key: ${{ runner.os }}-nx-${{ hashFiles('package-lock.json') }} | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.node-version' | ||
cache: 'npm' | ||
cache-dependency-path: 'package-lock.json' | ||
- run: npm ci | ||
- run: npm run test | ||
publish: | ||
if: (contains(' | ||
refs/heads/main | ||
refs/heads/develop | ||
', github.ref) || startsWith(github.ref, 'refs/tags/v')) && github.repository == 'fumiX/fuBlog' | ||
needs: [test, lint, publish-db-image] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- run: sudo apt-get install -y libsdl-pango-dev libgif-dev | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: dist-* | ||
merge-multiple: true | ||
- run: | | ||
cp -r server/dist/* docker/app/ | ||
cp -rT server/test-data/ docker/app/test-data/ | ||
cp -rT client/dist/ docker/app/public/ | ||
cp server/package.json docker/app/ | ||
mkdir -p "docker/app/node_modules/@fumix/" | ||
cp -rT common/ "docker/app/node_modules/@fumix/fu-blog-common" | ||
cd docker/app/ | ||
npm install | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ github.repository }}-app | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: docker/app | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
publish-db-image: | ||
if: (contains(' | ||
refs/heads/main | ||
refs/heads/develop | ||
', github.ref) || startsWith(github.ref, 'refs/tags/v')) && github.repository == 'fumiX/fuBlog' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
strategy: | ||
matrix: | ||
language: [ | ||
de_DE, | ||
en_GB, | ||
en_US | ||
] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ github.repository }}-postgres | ||
labels: | | ||
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}/tree/${{ github.sha }}/docker/postgres | ||
org.opencontainers.image.documentation=${{ github.server_url }}/${{ github.repository }}/tree/${{ github.sha }}/docker/postgres/README.md | ||
org.opencontainers.image.description=PostgreSQL image for use with the fu-blog, customized with locale ${{ matrix.language }} (for postgres search) | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}} | ||
type=ref,event=branch | ||
flavor: | | ||
latest=auto | ||
suffix=-${{ matrix.language }},onlatest=true | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
build-args: | | ||
language=${{ matrix.language }} | ||
context: docker/postgres | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |