Skip to content

Commit

Permalink
Update CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
cc-a committed Jul 3, 2024
1 parent eed7d0c commit 13c4178
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 38 deletions.
46 changes: 8 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
name: CI

on: push
on:
pull_request:
branches:
- main

jobs:
qa:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- uses: pre-commit/[email protected]
test:
needs: qa
Expand All @@ -16,8 +22,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: install system dependencies
run: sudo apt-get install libxml2-dev libxmlsec1-dev libxmlsec1-openssl
cache: "pipenv"
- name: install pipenv and invenio-cli
run: pip install pipenv invenio-cli
- name: setup project virtual environment
Expand All @@ -26,38 +31,3 @@ jobs:
run: invenio-cli services setup --no-demo-data
- name: run tests
run: pipenv run pytest
build-and-publish:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: test
steps:
- uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get image metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{steps.meta.outputs.tags }}
- name: Get image frontend metadata
id: frontend-meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: type=raw,value=frontend-main
- name: Build and push frontend Docker image
uses: docker/build-push-action@v4
with:
context: ./docker/nginx
push: true
tags: ${{steps.frontend-meta.outputs.tags }}
43 changes: 43 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and Publish

on:
push:
branches:
- main

jobs:
build-and-publish:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: test
steps:
- uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get image metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{steps.meta.outputs.tags }}
- name: Get image frontend metadata
id: frontend-meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: type=raw,value=frontend-main
- name: Build and push frontend Docker image
uses: docker/build-push-action@v4
with:
context: ./docker/nginx
push: true
tags: ${{steps.frontend-meta.outputs.tags }}

0 comments on commit 13c4178

Please sign in to comment.