Add workflows to update Docker images for E2E tests

This commit is contained in:
Thomas Lauf 2023-01-03 15:36:14 +01:00
parent 29479d064e
commit 808b5b0d0c
3 changed files with 185 additions and 0 deletions

View file

@ -0,0 +1,73 @@
name: Update Taskwarrior in Docker images
on:
workflow_dispatch:
inputs:
release:
type: choice
description: Taskwarrior release
options:
- develop
- stable
schedule:
- cron: 0 2 * * *
env:
REGISTRY: "ghcr.io"
RELEASE: ${{ github.event.inputs.release || 'develop' }}
jobs:
build-and-push-docker-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install cosign
uses: sigstore/cosign-installer@v2.8.1
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Taskwarrior [${{ env.RELEASE }}]/Timewarrior [devlop] Docker image
id: build-and-push-develop
uses: docker/build-push-action@v3.3.0
with:
context: .
file: "./test/docker/task-timew.dockerfile"
push: true
build-args: |
TASK_IMAGE=${{ env.REGISTRY }}/${{ github.repository_owner }}/task:${{ env.RELEASE }}
TIMEW_IMAGE=${{ env.REGISTRY }}/${{ github.repository_owner }}/timew:develop
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/task-timew:${{ env.RELEASE }}-develop
- name: Sign the published Docker image
env:
COSIGN_EXPERIMENTAL: "true"
run: cosign sign ${{ env.REGISTRY }}/${{ github.repository_owner }}/task-timew@${{ steps.build-and-push-develop.outputs.digest }}
- name: Build and push Taskwarrior [${{ env.RELEASE }}]/Timewarrior [stable] Docker image
id: build-and-push-stable
uses: docker/build-push-action@v3.3.0
with:
context: .
file: "./test/docker/task-timew.dockerfile"
push: true
build-args: |
TASK_IMAGE=${{ env.REGISTRY }}/${{ github.repository_owner }}/task:${{ env.RELEASE }}
TIMEW_IMAGE=${{ env.REGISTRY }}/${{ github.repository_owner }}/timew:stable
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/task-timew:${{ env.RELEASE }}-stable
- name: Sign the published Docker image
env:
COSIGN_EXPERIMENTAL: "true"
run: cosign sign ${{ env.REGISTRY }}/${{ github.repository_owner }}/task-timew@${{ steps.build-and-push-stable.outputs.digest }}

View file

@ -0,0 +1,73 @@
name: Update Timewarrior in Docker images
on:
workflow_dispatch:
inputs:
release:
type: choice
description: Timewarrior release
options:
- develop
- stable
schedule:
- cron: 0 2 * * *
env:
REGISTRY: "ghcr.io"
RELEASE: ${{ github.event.inputs.release || 'develop' }}
jobs:
build-and-push-docker-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install cosign
uses: sigstore/cosign-installer@v2.8.1
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Taskwarrior [develop]/Timewarrior [${{ env.RELEASE }}] Docker image
id: build-and-push-develop
uses: docker/build-push-action@v3.3.0
with:
context: .
file: "./test/docker/task-timew.dockerfile"
push: true
build-args: |
TASK_IMAGE=${{ env.REGISTRY }}/${{ github.repository_owner }}/task:develop
TIMEW_IMAGE=${{ env.REGISTRY }}/${{ github.repository_owner }}/timew:${{ env.RELEASE }}
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/task-timew:develop-${{ env.RELEASE }}
- name: Sign the published Docker image
env:
COSIGN_EXPERIMENTAL: "true"
run: cosign sign ${{ env.REGISTRY }}/${{ github.repository_owner }}/task-timew@${{ steps.build-and-push-develop.outputs.digest }}
- name: Build and push Taskwarrior [stable]/Timewarrior [${{ env.RELEASE }}] Docker image
id: build-and-push-stable
uses: docker/build-push-action@v3.3.0
with:
context: .
file: "./test/docker/task-timew.dockerfile"
push: true
build-args: |
TASK_IMAGE=${{ env.REGISTRY }}/${{ github.repository_owner }}/task:stable
TIMEW_IMAGE=${{ env.REGISTRY }}/${{ github.repository_owner }}/timew:${{ env.RELEASE }}
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/task-timew:stable-${{ env.RELEASE }}
- name: Sign the published Docker image
env:
COSIGN_EXPERIMENTAL: "true"
run: cosign sign ${{ env.REGISTRY }}/${{ github.repository_owner }}/task-timew@${{ steps.build-and-push-stable.outputs.digest }}

View file

@ -0,0 +1,39 @@
###############################################################################
#
# Copyright 2023, Gothenburg Bit Factory
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# https://www.opensource.org/licenses/mit-license.php
#
###############################################################################
ARG TASK_IMAGE
ARG TIMEW_IMAGE
FROM ${TIMEW_IMAGE} AS timew
FROM ${TASK_IMAGE} AS task
# Install Timewarrior
COPY --from=timew /usr/local/bin/timew /usr/local/bin
# Initialize Timewarrior
WORKDIR /root/
RUN timew :yes