docker-wikibase-actions-workflow #1259
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: docker-wikibase-actions-workflow | |
on: | |
push: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
PUSH_IMAGE: ${{ github.event_name != 'pull_request' | |
&& true || false}} | |
jobs: | |
build-base: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Start Measurement | |
uses: green-coding-solutions/eco-ci-energy-estimation@v3 # use hash or @vX here (See note below) | |
with: | |
task: start-measurement | |
- name: Checkout | |
uses: actions/checkout@v4.1.6 | |
- name: Checkout Repo Measurement | |
uses: green-coding-solutions/eco-ci-energy-estimation@v3 # use hash or @vX here (See note below) | |
with: | |
task: get-measurement | |
label: 'repo checkout' | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3.2.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5.5.1 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3.3.0 | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5.3.0 | |
with: | |
context: . | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Tests measurement | |
uses: green-coding-solutions/eco-ci-energy-estimation@v3 # use hash or @vX here (See note below) | |
with: | |
task: get-measurement | |
label: 'build and push' | |
- name: Show Energy Results | |
uses: green-coding-solutions/eco-ci-energy-estimation@v3 # use hash or @vX here (See note below) | |
with: | |
task: display-results | |
# continue-on-error: true # recommended setting for production. See notes below. | |
build-dev: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
needs: build-base | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.1.6 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3.2.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3.3.0 | |
- name: Build and push Docker dev image | |
uses: docker/build-push-action@v5.3.0 | |
with: | |
context: dev | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ghcr.io/mardi4nfdi/docker-wikibase:dev | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-jobrunner: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
needs: build-base | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.1.6 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3.2.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3.3.0 | |
- name: Build and push Docker jobrunner image | |
uses: docker/build-push-action@v5.3.0 | |
with: | |
context: jobrunner | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ghcr.io/mardi4nfdi/docker-redis-jobrunner | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-backup: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
needs: build-base | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.1.6 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3.2.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3.3.0 | |
- name: Build and push Docker jobrunner image | |
uses: docker/build-push-action@v5.3.0 | |
with: | |
context: backup | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ghcr.io/mardi4nfdi/docker-backup | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |