From 13c41786762d771f83e087bedf18e7af3f0f9c67 Mon Sep 17 00:00:00 2001 From: Christopher Cave-Ayland Date: Wed, 3 Jul 2024 15:26:25 +0100 Subject: [PATCH] Update CI workflows --- .github/workflows/ci.yml | 46 ++++++----------------------------- .github/workflows/publish.yml | 43 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efd2d3b..7007c08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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/action@v2.0.3 test: needs: qa @@ -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 @@ -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 }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..837e258 --- /dev/null +++ b/.github/workflows/publish.yml @@ -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 }}