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

build: do not build images on bot PRs #663

Merged
merged 1 commit into from
Mar 18, 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
57 changes: 57 additions & 0 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build Image
on:
pull_request:
types: [opened, synchronize, closed]

env:
TUTOR_ROOT: ./.ci/

jobs:
build:
strategy:
matrix:
service:
- name: aspects
repository: edunext/aspects
- name: aspects-superset
repository: edunext/aspects-superset
- name: openedx
repository: edunext/openedx-aspects
runs-on: ubuntu-latest
if: "!startsWith(github.head_ref, 'bot/') && !startsWith(github.head_ref, 'dependabot/')"
steps:
- name: Checkout
run:
echo ${{github.head_ref}}
- name: Log in to Docker Hub
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
with:
username: ${{ secrets.EDUNEXT_DOCKER_USERNAME }}
password: ${{ secrets.EDUNEXT_DOCKER_PASSWORD }}
- name: Checkout
uses: actions/checkout@v4
- name: Update ASPECTS_VERSION
if: github.event.action == 'opened' || github.event.action == 'synchronize'
run: |
ASPECTS_VERSION=pr-${{ github.event.pull_request.number }}
sed -i "s/ASPECTS_VERSION: .*/ASPECTS_VERSION: $ASPECTS_VERSION/" .ci/config.yml
- name: setup python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install aspects
run: pip install .
- name: Save config
run: tutor config save
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Aspects Docker Images
if: github.event.action == 'opened' || github.event.action == 'synchronize'
run: |
tutor images build ${{ matrix.service.name }}
tutor images push ${{ matrix.service.name }}
- name: Build Aspects Docker Images Latest
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'bot/v')
run: |
tutor images build ${{ matrix.service.name }} --cache-to-registry -d '--tag=${{ matrix.service.repository }}:latest'
tutor images push ${{ matrix.service.name }}
50 changes: 4 additions & 46 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: Release
on:
pull_request:
types: [opened, synchronize, closed]
types:
- closed
branches:
- main

env:
TUTOR_ROOT: ./.ci/
Expand Down Expand Up @@ -43,48 +46,3 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_UPLOAD_TOKEN }}

build:
strategy:
matrix:
service:
- name: aspects
repository: edunext/aspects
- name: aspects-superset
repository: edunext/aspects-superset
- name: openedx
repository: edunext/openedx-aspects
runs-on: ubuntu-latest
steps:
- name: Log in to Docker Hub
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
with:
username: ${{ secrets.EDUNEXT_DOCKER_USERNAME }}
password: ${{ secrets.EDUNEXT_DOCKER_PASSWORD }}
- name: Checkout
uses: actions/checkout@v4
- name: Update ASPECTS_VERSION
if: github.event.action == 'opened' || github.event.action == 'synchronize'
run: |
ASPECTS_VERSION=pr-${{ github.event.pull_request.number }}
sed -i "s/ASPECTS_VERSION: .*/ASPECTS_VERSION: $ASPECTS_VERSION/" .ci/config.yml
- name: setup python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install aspects
run: pip install .
- name: Save config
run: tutor config save
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Aspects Docker Images
if: github.event.action == 'opened' || github.event.action == 'synchronize'
run: |
tutor images build ${{ matrix.service.name }}
tutor images push ${{ matrix.service.name }}
- name: Build Aspects Docker Images Latest
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'bot/v')
run: |
tutor images build ${{ matrix.service.name }} --cache-to-registry -d '--tag=${{ matrix.service.repository }}:latest'
tutor images push ${{ matrix.service.name }}